Return Value
https://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp
Mehrdad makes some good points, but the main thing I noticed is that you never run the query...
SqlParameter retval = sqlcomm.Parameters.Add("@b", SqlDbType.VarChar);
retval.Direction = ParameterDirection.ReturnValue;
sqlcomm.ExecuteNonQuery(); // MISSING
string retunvalue = (string)sqlcomm.Parameters["@b"].Value;
Using a Stored Procedure with Output Parameters
https://stackoverflow.com/questions/10905782/using-stored-procedure-output-parameters-in-c-sharp
ParameterDirection Enum
Input | 1 |
The parameter is an input parameter. |
InputOutput | 3 |
The parameter is capable of both input and output. |
Output | 2 |
The parameter is an output parameter. |
ReturnValue | 6 |
The parameter represents a return value from an operation such as a stored procedure, built-in function, or user-defined function. |