>>>>>You're right, I miscounted. Did you also pass 10 0s ?
>>>>
>>>>Yes, as a string
>>>
>>>Did you test SP by itself just in case - though it's so simple I don't see a reason why it would not work.
>>
>>Just did and it seems to work. @NextNumber is "0000001045" just like I set it in the SP and the return value is 0 as expected. I will step into the C# code to see why it doesn't get back to there.
>>Tim
>
>What is your C# code? Did you remove extra parameter's declaration?
Yes, I tried it about a dozen ways. I tried this too.
SqlConnection conn = new SqlConnection(this.GetConnectionString("PantryWare"));
SqlCommand cmd = new SqlCommand();
object newVal;
cmd.CommandText = "dbo.GetNextNumber";
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@NextNumber", "0000000000");
param.Direction = ParameterDirection.Output;
cmd.Parameters.Add(param);
cmd.Connection = conn;
conn.Open();
newVal = cmd.ExecuteScalar();
conn.Close();
string myNumber = newVal.ToString();
newVal comes back Null.
Tim
Timothy Bryan