Size property has an invalid size of 0
You need to define a length when specifying the varchar
parameter:
SqlParameter job1 = cmd2.Parameters.Add("@job", SqlDbType.VarChar, 50);
You should use the same length as defined in your SQL Server stored procedure.
And btw: if your stored procedure also has no length defined (something like @job VARCHAR OUTPUT
) - then you've defined a varchar
string of 1 character length ......
Yes, have to define the length for varchar
/ nvarchar
data type like below.
cmd.Parameters.Add("@Description", SqlDbType.VarChar, 150).Direction =
ParameterDirection.Output;