Re: Return a single value from a Sybase stored procedure using ADO
- From: "Dmitriy Antonov" <antonovdima@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 3 Oct 2006 02:01:25 -0400
"Rick H" <rickh_1960@xxxxxxxxxxx> wrote in message
news:1159810680.434647.268750@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
Since you don't return any data set, then there is no recordset returned -
hence this error message. You'd should use Command object. It's Parameters
collection allows you to work with IN and/or OUT parameters and return
values. See ADO help for examples.
Dmitriy.
.
- Follow-Ups:
- References:
- Prev by Date: Return a single value from a Sybase stored procedure using ADO
- Next by Date: Detect & skip Deleted Record
- Previous by thread: Return a single value from a Sybase stored procedure using ADO
- Next by thread: Re: Return a single value from a Sybase stored procedure using ADO
- Index(es):
Relevant Pages
|