Hey
I'm having issues returning a value from a PL/SQL stored procedure.
I'm passing info from a vb6 front end, but not able to get the result, getting the ByRef argument type mismatch error.
Here's the code:
Private Sub cmdTestCount_Click()
Call CB_Test_Count(A_Combo_Code(cboSource.ListIndex))
'Calls the module Test Count. Here's the module code:
Public Function CB_Test_Count(SelectedUser As String)
Dim strSQL
Dim Prm_User As New ADODB.Parameter
Dim Prm_TestCount As New ADODB.Parameter
Dim Cmd As ADODB.Command
Dim GTC As ADODB.Recordset 'GetTestCount
strSQL = "{call PKG_BATCH_REASSIGN.P_TEST_COUNT" & _
"(?,{resultset 10000, TestCount})}"
Set Cmd = New ADODB.Command
Set Prm_User = Cmd.CreateParameter("in_UserID", adChar, adParamInput, 200, "XX")
Set Prm_TestCount = Cmd.CreateParameter("out_TestCount", adNumber, adParamOutput, 200, "XX")
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
.ConnectionString = ConnectionString$
.CursorLocation = adUseClient
.Open
End With
'sets role
'cn.Execute RoleCommand$
With Cmd
Set .ActiveConnection = cn
.CommandText = strSQL
.CommandType = adCmdText
.Parameters.Append Prm_User
'set the value that's handed in
Prm_User.Value = SelectedUser
.Parameters.Append Prm_TestCount
.Execute
End With
'Get Test Count
Set GTC = New ADODB.Recordset
GTC.CursorLocation = 3
Set CB_Test_Count = Prm_TestCount
'cn.Close
Set cn = Nothing
Set Prm_User = Nothing
Set GTC = Nothing
Set Cmd = Nothing
End Function
Any ideas why the mismatch error? Thanks for any advice.
I'm having issues returning a value from a PL/SQL stored procedure.
I'm passing info from a vb6 front end, but not able to get the result, getting the ByRef argument type mismatch error.
Here's the code:
Private Sub cmdTestCount_Click()
Call CB_Test_Count(A_Combo_Code(cboSource.ListIndex))
'Calls the module Test Count. Here's the module code:
Public Function CB_Test_Count(SelectedUser As String)
Dim strSQL
Dim Prm_User As New ADODB.Parameter
Dim Prm_TestCount As New ADODB.Parameter
Dim Cmd As ADODB.Command
Dim GTC As ADODB.Recordset 'GetTestCount
strSQL = "{call PKG_BATCH_REASSIGN.P_TEST_COUNT" & _
"(?,{resultset 10000, TestCount})}"
Set Cmd = New ADODB.Command
Set Prm_User = Cmd.CreateParameter("in_UserID", adChar, adParamInput, 200, "XX")
Set Prm_TestCount = Cmd.CreateParameter("out_TestCount", adNumber, adParamOutput, 200, "XX")
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
.ConnectionString = ConnectionString$
.CursorLocation = adUseClient
.Open
End With
'sets role
'cn.Execute RoleCommand$
With Cmd
Set .ActiveConnection = cn
.CommandText = strSQL
.CommandType = adCmdText
.Parameters.Append Prm_User
'set the value that's handed in
Prm_User.Value = SelectedUser
.Parameters.Append Prm_TestCount
.Execute
End With
'Get Test Count
Set GTC = New ADODB.Recordset
GTC.CursorLocation = 3
Set CB_Test_Count = Prm_TestCount
'cn.Close
Set cn = Nothing
Set Prm_User = Nothing
Set GTC = Nothing
Set Cmd = Nothing
End Function
Any ideas why the mismatch error? Thanks for any advice.