Re: Return a single value from a Sybase stored procedure using ADO

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

.



Relevant Pages

  • Re: Return a single value from a Sybase stored procedure using ADO
    ... I need to return a number from a Sybase SQLAnywherestored procedure ... proper value but I get error on the ADO call. ... The error message appears at the "While Not" line ... Dim objRs As Object ...
    (microsoft.public.vb.database.ado)
  • Return a single value from a Sybase stored procedure using ADO
    ... I need to return a number from a Sybase SQLAnywherestored procedure ... The error message appears at the "While Not" line ... Dim objConn As Object ... Dim objRs As Object ...
    (microsoft.public.vb.database.ado)
  • Re: Really need help! ADO not working
    ... Set cnn = CurrentProject.Connection ... I'm guessing the error message doesn't say, ... See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. ... ' Microsoft ADO Ext. 2.8 for DDL and Security ...
    (microsoft.public.access.modulesdaovba)
  • RE: Wondering why the following ADO connection to Access isnt working
    ... When does it fail and what error message are you getting? ... Set MYdb as New ADODB.Connection)? ... Some general troubleshooting guidelines I use with ADO: ... - Make sure you have the connection string correct. ...
    (microsoft.public.excel.programming)
  • Re: Problems inserting records
    ... I am confused by the DAO vs ADO approach. ... table in design view, and make sure the field's Indexed property (lower pane ... But the error message you reported suggests you have another table where the ...
    (microsoft.public.access.modulesdaovba)