HOWTO: Extract Multiple RDO Resultsets from Stored ProceduresLast reviewed: October 13, 1997Article ID: Q154825 |
The information in this article applies to:
SUMMARYSQL Server stored procedures are capable of returning more than one recordset and the Remote Data Object (RDO) has the ability to access these Multiple Resultsets. When calling these stored procedures, the following error can be encountered:
Error 40002 "37000: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open a cursor on a stored procedure that has anything other than a single select statement in it"Below is a code sample showing how to return the multiple Resultsets using the MoreResults Property of the RDO.
MORE INFORMATIONThere are two methods to avoid Error 40002.
Method 1Use The ODBC Cursor library rather than Server Side Cursors. To do this, use the following code:
rdoEngine. rdoDefaultCursorDriver = rdUseODBC
- or -
rdoEnvironments(0).CursorDriver = rdUseOdbc
This option gives better performance for small result sets, but may degrade
quickly for larger result sets depending on the Server and workstation
configuration.
Method 2Use Server Side Cursors, a Forward Only Cursor, and a rowset size of 1. Make the server create a cursor-less resultset on the server side by using a forward only cursor and a RowSetSize of 1. The code sample below illustrates how to create a stored procedure that returns multiple result sets using method 2:
REFERENCESFor more information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q147875 TITLE : HOWTO: Use "DSN-Less" ODBC Connections with RDO and DAO ARTICLE-ID: Q147814 TITLE : HOWTO: Retrieve Multiple Result Sets from a Stored Procedure ARTICLE-ID: Q149054RDO TITLE : Choosing a rdoResultset Cursortype Keywords : APrgDataRDO VB4ALL VB4WIN vb5all vb5howto VBKBDB VBKBNet kbusage kbhowto Version : 4.0 5.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |