CREATE PROCEDURE TestNewNumber @NewNumber varchar(10) OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SET @NewNumber = '00000' END RETURN @NewNumberThe C# code I am using is this:
// Create the parameter and set the direction IDbDataParameter param1 = this.CreateParameter("@newNumber", 0); param1.Direction = ParameterDirection.Output; IDbCommand cmd; this.ExecSprocScalar("TestNewNumber", out cmd, param1); // Retrieve the value from the command object IDbDataParameter param = (IDbDataParameter)cmd.Parameters["@newNumber"]; string newNumber = (string)param.Value;The problem is that param.Value is returning an integer (0 in this case) rather than the expected string '00000'.