NextRecordset and GetRows may be used very little!
I've used it recently, a good thing!
It is very effective for increasing batch query and query record sets are not huge.
NextRecordset and GetRows are two properties of Recordset (I often confuse the properties or methods of #$#$, and I can't figure out the difference between them)
GetRows---> Extract the recordset record set into a two-dimensional array. Our behavior of recordset data is transferred to the array. We can disconnect the record set early without using metadata operations. rs.movnext, whilenotrs.eof, etc. can save it.
NextRecordset----> is to provide a recordset that leaves the current work and transfer to the second recordset when multiple queries are submitted at once and multiple recordset result sets are formed!
It is mainly used in the case of result sets formed by multiple SELECTs
Examples are as follows:
dimSQL,Rs,arrA,arrB,rowsA,rowsB
''====== Extract database library records====
(The connection part of adodb.connection is omitted, assuming CONN.openCONNstr)
SQL="selectCa1,Ca2,Ca3,Ca4fromTableA"''---------------SELECTa
SQL=SQL&"selectCb1,Cb2,Cb3,Cb4,Cb5fromTableB"''-------------SELECTb
SetRs=conn.execute(SQL)
''The execution result will have two select result sets, and the recordset of the first select is currently active
arrA=rs.GetRows''----------get the 2D array of SElECTaRecordset
setrs=rs.NextRecordset
''---------------------The most critical step is to use Nextrecordset to activate the next recordset
arrB=rs.GetRows''---------Get the second SElECTbRecordset's two-dimensional array again
Rs.close
setrs=nothing''--------Release the database object as soon as possible and close the record set
CONN.close
setCONN=Nothing
In this way, all our data about the database is extracted cleanly and the database resources are released at the earliest time.
''----------//
''======== Use the obtained arrAarrB to perform the page processing, display the data result======
''Note that the array obtained after arrA=GetRows, the first dimension represents the column, and the second dimension represents the row
rowsA=ubund(arrA,2)''----Extract the second dimension subscript of arrA, which is equivalent to obtaining the record line number of records
rowsB=ubund(arrB,2)''-----Same as above, extract the second dimension subscript of arrB
''Doing data loops:
''The loop of the first select table
response.write"<table>"
Fori=0torowsA
response.write"<tr>
response.write"<td>"&arrA(i,0)&"</td>"''tableA.Ca1
response.write"<td>"&arrA(i,1)&"</td>"''tableA.Ca2
response.write"<td>"&arrA(i,2)&"</td>"''tableA.Ca3
response.write"<td>"&arrA(i,3)&"</td>"''tableA.Ca4
response.write"</tr>"
Next
response.write"</table>
''The second select table loop