![]() |
|
|
Recordset GetRows MethodThe GetRows method of the Recordset object lets you retrieve the resultset and place into a two-dimensional array. The code below then loops through that 2 dimensional array 'ArrResults' and displays the records. (You can read more on multi-dimensional arrays.) The standard way to retrieve and display records has been to create a recordset object and loop through the records, though with the GetRows method there is only one call to the database making for more efficient code. We use the UBound function which returns the index of the highest element in the array for both dimensions, this basically lets us know how many times to loop through both the rows and columns.
<% 'define the connection string, specify database 'Create our connection objection 'declare SQL statement that will query the database 'create and fill our recordset object If Not oRecordSet.EOF Then 'Close the connection and recordset objects ' Retrieve the total no. of rows (second dimension of the array) 'Loop through the array holding the resultset and display records Else If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site. Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|