Return a single value from a Sybase stored procedure using ADO

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have been fighting with this for a couple days.
I need to return a number from a Sybase SQLAnywhere(9) stored procedure
which has one In parameter (string) and one Out (integer).
I'm calling it from a Outlook Com addin (VB6).
I debug the SP in Sybase and it fires and sets the return value to the
proper value but I get error on the ADO call.

Error Message:

"Run Time Error '3704'"
"Operation is not allowed when the object is closed"

The error message appears at the "While Not" line

The ADO code:

Dim objConn As Object
Dim objRs As Object
Set objConn = CreateObject("ADODB.Connection")
Set objRs = CreateObject("ADODB.Recordset")
objConn.connectionString = testt
objConn.Open
objRs.Open "exec get_new_key 'appnt_key'", objConn
While Not objRs.EOF
atlnum = objRs.Fields(0)
objRs.MoveNext
Wend

.



Relevant Pages