Returning Multiple Recordsets to ASP

Returning Multiple Recordsets to ASP

What are my options when I need to send multiple recordsets back to ASP from a single call? Which is the best for performance?

You can return multiple recordsets from a single query (such as in SQL Server). The trick to accessing them is the NextRecordset method. Here’s a quick example of how to do this. Assume that the stored procedure is as follows:

Create Procedure sp_GetLotsOfDataAsSelect * From tblCustomersSelect * From tblOrdersSelect * From tblShippers

To get at this data, you can use this code:

Dim rsCust, rsOrders, rsShippers ' As ADODB.RecordsetDim dcnDB ' As ADODB.ConnectionSet dcnDB = Server.CreateObject("ADODB.Connection")dcnDB.Open "some connection string"Set rsCust = Server.CreateObject("ADODB.Recordset")rsCust.Open "sp_GetLotsOfData", dcnDB, adOpenStatic' At this point, rsCust will point to the first recordset. Set rsOrders = rsCust.NextRecordsetSet rsShippers = rsOrders.NextRecordset' Now you can do whatever you want with the three recordsets. 

See also  5 Tips for Working With an Onsite Interpreter

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist