MS SQL return value

  • Thread starter Thread starter Markus Freitag
  • Start date Start date
M

Markus Freitag

Guest
Hello,
I have this.

CREATE PROCEDURE [dbo].[procGetSerialNumber]
@Line nvarchar(40),
@Family nvarchar(60)
AS
SELECT * from [dbo].[LOCALDB] where ColumnFamily=@Family
RETURN 7

and want to get the return value.
How is the right way?

SqlParameter RetVal = cmd.Parameters.Add("RetVal", SqlDbType.Int);
RetVal.Direction = ParameterDirection.ReturnValue;



using (SqlDataReader rdr = cmd.ExecuteReader())
{
//Get the return value
int returnvalue = (int)cmd.Parameters["ReturnValue"].Value;

Sure I need Input , Output Parameter in the right way.

Is there a good sample in the net.

Greetings Markus

Continue reading...
 
Back
Top