get return value stored procedure

Richnl

Well-known member
Joined
Mar 20, 2007
Messages
93
Programming Experience
Beginner
I looked everywhere
and they all use sqlcommand objects

but that seems to much
I already know about output params, but not return values
is there an easy way to get the return value?

thanks, Richard
 
Last edited:
Add a parameter to your colelction with the direction set to ReturnValue:

cmd.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", SqlDbType, 0, ParameterDirection.ReturnValue, 0, 0, Nothing, DataRowVersion.Current, false, Nothing, "", "", ""))

or use whatever overload suits you. I just nicked this one from some designer generated code

Which leads me to ask a valid quetion:

Why do you care about this? You should be doing your data access with tableadapters, where a wizard writes perfect code to get the return value for you. See my recent post here:
http://www.vbdotnetforums.com/showthread.php?t=19771
 
Back
Top