Re: Return a single value from a Sybase stored procedure using ADO
- From: "Rick H" <rickh_1960@xxxxxxxxxxx>
- Date: 3 Oct 2006 08:46:48 -0700
I had tried to use the Parameter object but kept getting errors
I used the constant value 4 instead of adCmdStoredProc and replaced all
the constants with the numerical values and it worked.
Thanks for putting me back on the right track.
Dmitriy Antonov wrote:
"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.
.
- References:
- Return a single value from a Sybase stored procedure using ADO
- From: Rick H
- Re: Return a single value from a Sybase stored procedure using ADO
- From: Dmitriy Antonov
- Return a single value from a Sybase stored procedure using ADO
- Prev by Date: Detect & skip Deleted Record
- Next by Date: Re: Detect & skip Deleted Record
- Previous by thread: Re: Return a single value from a Sybase stored procedure using ADO
- Next by thread: Detect & skip Deleted Record
- Index(es):
Relevant Pages
|