By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

return value from stored proc using MS Data Access Application Block

P: n/a
How do I read a stored proc return value ( return(@return_value) )
using MS Data Access Application Block.

Normally I use:

Dim conn As SqlConnection = New
SqlConnection("connectionstring")
Dim cmd As SqlCommand = New SqlCommand
cmd.Connection = conn
cmd.CommandText = "NameOfStoredProc"
cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@Param1", SqlDbType.Int)
cmd.Parameters("@Param1").Value = [value]

Dim retParam As SqlParameter =
cmd.Parameters.Add("@return_value", SqlDbType.Int)
retParam.Direction = ParameterDirection.ReturnValue

conn.Open()
cmd.ExecuteNonQuery()
conn.Close()

[local var] = retParam.Value

I figure I must use SqlHelper.ExecuteScalar... but can't find out how!

Please help

Morten

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.