Retrieve Output from a stored Procedure

  • Thread starter Thread starter Dave McKie
  • Start date Start date
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
 
Back
Top