ADO GetRows Method
Complete Recordset Object Reference
The GetRows method copies multiple records from a Recordset object into a two-dimensional array.
Syntax
vararray=objRecordset.GetRows(rows,start,fields)
|
Parameter |
Description |
rows |
Optional. A GetRowsOptionEnum
value that specifies the number of records to retrieve.
Default is adGetRowsRest. Note: If you omit this argument it will retrieve all
records in the Recordset
|
start |
Optional. What record to start on, a record number or a BookmarkEnum
value |
fields |
Optional. If you want to specify only the fields that the GetRows call
will return, it is possible to pass a single field name/number or an array of field names/numbers in
this argument
|
Example
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("northwind.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn
'The first number indicates how many records to copy
'The second number indicates what recordnumber to start on
p=rs.GetRows(2,0)
rs.close
conn.close
'This example returns the value of the first
'column in the first two records
response.write(p(0,0))
response.write("<br />")
response.write(p(0,1))
'This example returns the value of the first
'three columns in the first record
response.write(p(0,0))
response.write("<br />")
response.write(p(1,0))
response.write("<br />")
response.write(p(2,0))
%>
|
GetRowsOptionEnum Values
Constant |
Value |
Description |
adGetRowsRest |
-1 |
Retrieves the rest of the records in the Recordset object |
BookmarkEnum Values
Constant |
Value |
Description |
adBookmarkCurrent |
0 |
Starts at the current record |
adBookmarkFirst |
1 |
Starts at the first record |
adBookmarkLast |
2 |
Starts at the last record |
Complete Recordset Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|