dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Apr 14, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Returning Multiple Recordsets to ASP

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

Answer:
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_GetLotsOfData
As
Select * From tblCustomers
Select * From tblOrders
Select * From tblShippers
To get at this data, you can use this code:
Dim rsCust, rsOrders, rsShippers ' As ADODB.Recordset
Dim dcnDB ' As ADODB.Connection
Set 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.NextRecordset
Set rsShippers = rsOrders.NextRecordset
' Now you can do whatever you want with the three recordsets. 
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date