I make a select in a stored procedure
SELECT id
FROM table
WHERE isbn = @Isbn
I want to get this value in a webservice.
So i make this :
SqlCommand cmd = new SqlCommand("MyStoredProcedure", connection);
cmd.CommandType = CommandType.StoredProcedure;
object returnObj = cmd.ExecuteScalar();
int returnValue = -1;
if (returnObj != null)
{
int.TryParse(returnObj.ToString(), out returnValue);
}
But returnValue is always null.
How can I get the value from the SELECT from my stored procedure ?