Retrieve Output from a stored Procedure

D

Dave McKie

Hi all,

Need some help again. I am trying to retrieve an output from a Stored
Procedure...not having much luck. If anyone could steer me in the
right direction, it would be appreciated. I'm using SQL 2000 and
VB.Net

the Stored Proc is working fine. The following is just a test to
return it to the program

Dim dbConn As New SqlConnection(LCDBConnect.ConnectionString)
Dim dbCmd As New SqlCommand
Dim da As New SqlDataAdapter(dbCmd)

dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Connection = dbConn
dbCmd.CommandText = "spRenTempTable"
dbCmd.Parameters.Add("@MyTable", SqlDbType.VarChar)

dbCmd.Parameters("@MyTable").Direction =
ParameterDirection.Output
Try
dbConn.Open()
dbCmd.ExecuteNonQuery()
MessageBox.Show("Return Value : " &
dbCmd.Parameters("@MyTable").Value)
Catch ex As Exception
MessageBox.Show(ex.ToString())
Finally
dbConn.Close()
End Try


thanks for your help
Dave McKie
11/1/2004
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top