Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getrows and multiple recordsets

Status
Not open for further replies.

meckeard

Programmer
Joined
Aug 17, 2001
Messages
619
Location
US
Hi All,

Let's say I am returning a recordset that has 2 recordsets within it. Is it possible to still use getrows and be able to access both recordsets?

I am looking to reduce the amount of hits to my database and already return some records. I dump them into an array using getrows and thought I might be able to return 2 recordsets and do something like this:

arrArray1 = objRS.GetRows
objRS.MoveNextRecordset
arrArray2 = objRS.GetRows

Is something like this possible?

Thanks,
Mark
 
You could re-use the same recordset again, but I think trying to join the recordsets in some manner would actually make more work for the web server. Two runs to the database won't be bad, especially if your dropping the data into arrays and getting rid of the recordsets as fast as possible:
Code:
Dim sql_qrya, rs_qrya, arr_qrya, sql_qryb, rs_qryb, arr_qryb
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open("Connection string here")
'sql statements
sql_qrya = "sql 1 here"
sql_qryb = "sql 2 here"

'pull back the first recordset, dump in array
Set rs_qrya = conn.Execute(sql_qrya)
arr_qrya = rs_qrya.GetRows()
'clear up memory for this object
Set rs_qrya = Nothing

'pull back the second recordset, dump in array
Set rs_qryb = conn.Execute(sql_qryb)
arr_qryb = rs_qryb.GetRows()
'clear up memory for this object
Set rs_qryb = Nothing

technioally I could have used the same recordset variable for both returned recordset objects, but I prefer to keep them seperate for readability.

-T


01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top