How to get the return value from SP

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Hi,
I am not sure how i am able to get the return value from a SP
like:

Create procedure testing
@try int
as
If @try = 1
Return 1
else
Return 2

What codes should i use to get the reutrn value?
cmd.Parameters.append cmd.createparameter("@try", adinteger)
....
....
....
msgbox cmd.parameter("@Try")

but I want to answer to be the value from the "Return"(either 1 or 2)
Also, what is the difference between "adParamReturnValue" and "adParamOutput"?
Thanks
Ed
 
You must add a parameter of type adParamReturnValue and it must be the first
of the list, if I remember correctly. I think that you must also have read
the full recordset (to be at the EOF marker) before it is accessible,
because it is the last thing transmitted.

For an exemple:

http://www.schemamania.org/jkl/booksonline/SQLBOL70/html/adoprg01_20.htm

http://support.microsoft.com/default.aspx?scid=kb;EN-US;194792

Don't confuse the adParamReturnValue, associated with the Return statement,
and adParamOutput value, which is for Input/Output parameters (SQL-Server
doesn't have an Output only type of parameter: each parameter is either
Input only or Input/Output, but cannot be Output only).

S. L.
 
Back
Top