[ACCEPTED]-How do I call a TSQL function from ado.net-ado.net
Accepted answer
The only difference is that you must have 2 a special paramter added for the return 1 value
See: MySqlCommand call function
using (var connection = new SqlConnection("ConnectionString"))
using (var command = connection.CreateCommand())
{
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "MyFunction";
SqlParameter returnValue = command.Parameters.Add("@RETURN_VALUE", SqlDbType.Int);
returnValue.Direction = ParameterDirection.ReturnValue;
connection.Open();
command.ExecuteNonQuery();
return returnValue.Value;
}
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.