Chris Wallace
Mar 8th, 2000, 11:10 PM
Can anyone help,
From VB6 I can call an Oracle stored procedure no problem. However, I need to get a return value from the stored procedure.
To do this I have written an Oracle function that sums 2 values, here it is:
********
function ExFunct (Num1 in number, Num2 in Number ) return number
is
temp number;
begin
temp := Num1 + Num2;
return temp;
end ExFunct;
'***************************
'***HERE IS THE VB6 CODE****
Public Sub GetSPVal()
'Executes an action query, returns RecordsAffected
On Error GoTo ehExecuteSQL
Dim cn As ADODB.Connection
Dim objComm As ADODB.Command
Set cn = New ADODB.Connection
Set objComm = New ADODB.Command
cn.Open strConnect
Set objComm.activeconnection = cn
objComm.commandtype = adCmdText
objComm.CommandText = "{? = call ExFunct (2,2)}"
objComm.execute
MsgBox objComm.Parameters(0).Value
'cn.execute strSQL, ExecuteSQL 'RecordsAffected is returned
Exit Sub
ehExecuteSQL:
'If Transaction is not commited, it will be rolled back
ExecuteSQL = -2 '-2 indicates error condition
End Sub
*****
MY ERROR THAT I GET IS:-
[Oracle][ODBC Oracle Driver]SQLBindParameter has not been called for parameter #1.
Thanks for any help,
Chris
From VB6 I can call an Oracle stored procedure no problem. However, I need to get a return value from the stored procedure.
To do this I have written an Oracle function that sums 2 values, here it is:
********
function ExFunct (Num1 in number, Num2 in Number ) return number
is
temp number;
begin
temp := Num1 + Num2;
return temp;
end ExFunct;
'***************************
'***HERE IS THE VB6 CODE****
Public Sub GetSPVal()
'Executes an action query, returns RecordsAffected
On Error GoTo ehExecuteSQL
Dim cn As ADODB.Connection
Dim objComm As ADODB.Command
Set cn = New ADODB.Connection
Set objComm = New ADODB.Command
cn.Open strConnect
Set objComm.activeconnection = cn
objComm.commandtype = adCmdText
objComm.CommandText = "{? = call ExFunct (2,2)}"
objComm.execute
MsgBox objComm.Parameters(0).Value
'cn.execute strSQL, ExecuteSQL 'RecordsAffected is returned
Exit Sub
ehExecuteSQL:
'If Transaction is not commited, it will be rolled back
ExecuteSQL = -2 '-2 indicates error condition
End Sub
*****
MY ERROR THAT I GET IS:-
[Oracle][ODBC Oracle Driver]SQLBindParameter has not been called for parameter #1.
Thanks for any help,
Chris