HOWTO: Return Multiple Recordsets with Column Names and ValuesLast reviewed: March 12, 1998Article ID: Q182290 |
The information in this article applies to:
SUMMARYThis article contains sample code using Visual Basic version 5.0 that demonstrates how to return multiple ADO Recordsets from a Microsoft SQL Server stored procedure. The code also demonstrates how to extract the column names and values from each ADO Recordset as each row is returned. Returning multiple ADO Recordsets is only supported using Server-Side Firehouse cursors, which are Forward-Only, Read-Only Recordsets that reside on the Server.
MORE INFORMATIONThis application requires a Microsoft SQL Server stored procedure that will return multiple Recordsets. An example of the script required to accomplish this task is given below. It is assumed that the reader is familiar with creating stored procedures in Microsoft SQL Server. This stored procedure uses the pubs database supplied with Microsoft SQL Server. You need to run the following script against the pubs database before running the sample code:
CREATE PROCEDURE Multi_Results AS SELECT * FROM Authors SELECT * FROM Stores SELECT * FROM Sales GONOTE: You need to acquire and install the Microsoft Data Access Components (MDAC) 1.5 stack for the sample in this article. Please refer to the article listed in the REFERENCES section for more information on MDAC 1.5. After the stored procedure is created, follow these steps:
' Set Rs1 = Rs1.NextRecordset If Rs1.State = adStateOpen Then Debug.Print Debug.Print "***** NEXT RECORDSET *****" Else Debug.Print Debug.Print "***** THE END *****" Exit Do End If Loop Set Rs1 = Nothing Unload Me 'Quit the application. End SubRun the application by pressing F5 and click the command button. The results will be displayed in the Debug window.
REFERENCESFor additional information on MDAC 1.5, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q175018 TITLE : HOWTO: Acquire and Install the Microsoft Oracle ODBC Driver v2.0(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Ron Nelson, Microsoft Corporation Keywords : mdacGenInfo Version : WINDOWS:1.5 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |