Please visit our sponsors !
The GetRows Method
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)
'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))
rs.close
conn.close
%>
|
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 |
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|