Kald af stored procedure i Oracle og returnering af resultset
Jeg har et problem med noget kode der får en 'Syntax error or access violation'-fejl.Jeg skal kalde en stored procedure i Oracle 8 og returnere et resultset. Kaldet skal foretages med et ADODB-objekt.
Min ODBC er en Microsoft ODBC for Oracle ver. 2.573.7713.00
Her er koden:
================================================
Private Sub Form_Load()
Conn = "UID=scott;PWD=tiger;driver=" _
& "{Microsoft ODBC for Oracle};SERVER=OracleDB;"
Set Cn = New ADODB.Connection
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
QSQL = "{call proc_name({resultset 9, col_name})}"
Set CPw1 = New ADODB.Command
With CPw1
Set .ActiveConnection = Cn
.CommandText = QSQL
.CommandType = adCmdText
End With
Set Rs = New ADODB.Recordset
With Rs
.CursorType = adOpenStatic
.LockType = adLockReadOnly
End With
End Sub
Private Sub cmdGetEveryone_Click()
Set Rs.Source = CPw1
Rs.Open '<< HER FEJLER KODEN >>
While Not Rs.EOF
MsgBox "Column data: " & Rs(0)
Rs.MoveNext
Wend
Rs.Close
End Sub