digitallyskilled
IS-IT--Management
I need help returning data back to VB from a stored procedure. Everytime I run the below code I get a catastrophic error. I have an field that I want to return from the stored procedure. If it was an Int I could get it using the return value but since it needs to be a string I cant use adParamReturnValue
' Open Connection to Database
Dim Conn1 As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim ErrorCode As ADODB.Error
Dim ErrorMessage As String
Dim TransError As String
Dim objRS As ADODB.Recordset
Set Conn1 = New ADODB.Connection
Set cmd = New ADODB.Command
Set objRS = New ADODB.Recordset
ConnAdPronto.ConnectionString = CONNECTION_STRING
Conn1.Open
Conn1.BeginTrans
' Call Stored Procedure
cmd.ActiveConnection = Conn1
cmd.CommandText = "__AcctDataLoadTest"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append _
cmd.CreateParameter("OrderId", adInteger, _
adParamInput, 4, 800020)
'cmd.Parameters.Append _
'cmd.CreateParameter("@TransError", adVarChar, _
' adParamOutput, 500)
On Error GoTo SystemErrorHandler
Set objRS = cmd.Execute
' Open Connection to Database
Dim Conn1 As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim ErrorCode As ADODB.Error
Dim ErrorMessage As String
Dim TransError As String
Dim objRS As ADODB.Recordset
Set Conn1 = New ADODB.Connection
Set cmd = New ADODB.Command
Set objRS = New ADODB.Recordset
ConnAdPronto.ConnectionString = CONNECTION_STRING
Conn1.Open
Conn1.BeginTrans
' Call Stored Procedure
cmd.ActiveConnection = Conn1
cmd.CommandText = "__AcctDataLoadTest"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append _
cmd.CreateParameter("OrderId", adInteger, _
adParamInput, 4, 800020)
'cmd.Parameters.Append _
'cmd.CreateParameter("@TransError", adVarChar, _
' adParamOutput, 500)
On Error GoTo SystemErrorHandler
Set objRS = cmd.Execute