ADO - Getting Stored Procedure Return codes 
Author Message
 ADO - Getting Stored Procedure Return codes

Hello,

    I am calling a stored proc in Sybase which returns a value -1 upon
failure or an eight-byte integer when successfull.  I am using ADO.  I
have set up a connection object, command object and a recordset object.
The stored proc accepts one parameter.  I have set this up using a
parameter object and then appending it to the command object.  The
stored proc runs, because after I call it, I check a table that it
increments and the value is incremented every time I run the code in
VB.  My resultset set is always empty.  I have even tried setting up a
second paramter object as an "adParamReturnValue" type object and
appending it to my command object.

Is there a way to get the return status of stored procs using ADO, or do

I have to recode all my stored procs with an extra outbound parameter?

Thanks to anyone who can help...



Fri, 20 Jul 2001 03:00:00 GMT  
 ADO - Getting Stored Procedure Return codes
Hi Manuel

I haven't myself used this feature <yet> but I believe you can specify the
parameter as both an input and output parameter.  Doing so should permit you
to use a single parameter for both purposes.

If this doesn't work, you might be able to use the NativeError property or
SQLState property of the ADODB.Errors Collection Error Object(s) to
enumerate error return values, depending on the specifics of your proc.
Hope this helps.

Regards,

JB

Quote:

>Hello,

>    I am calling a stored proc in Sybase which returns a value -1 upon
>failure or an eight-byte integer when successfull.  I am using ADO.  I
>have set up a connection object, command object and a recordset object.
>The stored proc accepts one parameter.  I have set this up using a
>parameter object and then appending it to the command object.  The
>stored proc runs, because after I call it, I check a table that it
>increments and the value is incremented every time I run the code in
>VB.  My resultset set is always empty.  I have even tried setting up a
>second paramter object as an "adParamReturnValue" type object and
>appending it to my command object.

>Is there a way to get the return status of stored procs using ADO, or do

>I have to recode all my stored procs with an extra outbound parameter?

>Thanks to anyone who can help...



Fri, 20 Jul 2001 03:00:00 GMT  
 ADO - Getting Stored Procedure Return codes
This is just off the top of my head.  In RDO, you can always retrieve the
return value of a stored procedure.  It is parameter 0 in the parameters
collection of the rdoQuery object.  Check and see if the same thing applies
for ADO
Good luck,
Ted Gordon
Quote:

>Hello,

>    I am calling a stored proc in Sybase which returns a value -1 upon
>failure or an eight-byte integer when successfull.  I am using ADO.  I
>have set up a connection object, command object and a recordset object.
>The stored proc accepts one parameter.  I have set this up using a
>parameter object and then appending it to the command object.  The
>stored proc runs, because after I call it, I check a table that it
>increments and the value is incremented every time I run the code in
>VB.  My resultset set is always empty.  I have even tried setting up a
>second paramter object as an "adParamReturnValue" type object and
>appending it to my command object.

>Is there a way to get the return status of stored procs using ADO, or do

>I have to recode all my stored procs with an extra outbound parameter?

>Thanks to anyone who can help...



Fri, 20 Jul 2001 03:00:00 GMT  
 ADO - Getting Stored Procedure Return codes
I was thinking about this later.  If the procedure you're running doesn't
return rows (for instance, if it's an update query), I don't think you can
capture a procedure's return value in a recordset.  Can't you do something
like:

Dim intRetVal As Integer

(code to set up the ADO connection and command object)

intRetVal = command.execute

Ted Gordon

Quote:

>Hello,

>    I am calling a stored proc in Sybase which returns a value -1 upon
>failure or an eight-byte integer when successfull.  I am using ADO.  I
>have set up a connection object, command object and a recordset object.
>The stored proc accepts one parameter.  I have set this up using a
>parameter object and then appending it to the command object.  The
>stored proc runs, because after I call it, I check a table that it
>increments and the value is incremented every time I run the code in
>VB.  My resultset set is always empty.  I have even tried setting up a
>second paramter object as an "adParamReturnValue" type object and
>appending it to my command object.

>Is there a way to get the return status of stored procs using ADO, or do

>I have to recode all my stored procs with an extra outbound parameter?

>Thanks to anyone who can help...



Sat, 21 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. stored procedures: return codes and return status with rdo

2. Getting a return value from a SQL Server stored procedure through VB

3. Getting a return value from a stored procedure in SQL Server

4. Problem getting parameter returned from stored procedure in VB

5. ado recordsets from stored procedures, stored procedures have input parameters

6. Returning resultsets from Oracle stored procedures via ADO?

7. ADO or DataEnvironment COMMAND Using Store procedure can't return recordset

8. Opening an ADO recordset against a dataset returned from a SQL Server Stored Procedure

9. SQL stored procedure returning unusual ado recordset

10. Stored Procedure Return Value and ADO question

11. HELP!!!!, using ADO + SQL 2000 + Stored procedures does not return a value

12. HELP!!!!, using ADO + SQL 2000 + Stored procedures does not return a value

 

 
Powered by phpBB® Forum Software