I am new to writing Stored Procedure. So I wrote one with output parameters and want to access the output value, hot to do it.
My Stored Procedure:
A
There are a several things you need to address to get it working
@ouput its @code AddWithValue since its not supposed to have a value just you Add.ExecuteNonQuery if you're not returning rows Try
SqlParameter output = new SqlParameter("@code", SqlDbType.Int);
output.Direction = ParameterDirection.Output;
cmd.Parameters.Add(output);
cmd.ExecuteNonQuery();
MessageBox.Show(output.Value.ToString());