ADO » Recordset » GetRows

Syntax:
variant = recordsetobject.GetRows (Rows, Start, Fields)
Rows
The optional Rows parameter is one of the GetRowsOptionEnum constants which specify how many records to retrieve. Even if you request more records than are available in the Recordset, only the actual number of records will be returned and no error will be generated. The default is to select all records starting from the current record.
Start
The optional Start parameter is a variant that is either a bookmark or one of the BookmarkEnum constants that indicates the starting position for the search. The default is to start at the current record.
Fields
The optional Fields parameter is a variant that can be a single field name, an ordinal position of a field, an array of field names, or an array of ordinal positions of the fields that you wish retrieved. It is used to restrict the fields that will be returned by calling this method. The order in which the field names are listed dictates the order in which they are returned.

Used to copy either all or a specified number of records into a two-dimensional array.

The GetRows method is used to copy records from a Recordset object into a variant that is a two-dimensional array. The variant array is automatically dimensioned (sized) to fit the requested number of columns and rows. To allow backwards compatibility with earlier versions of ADO, the columns are placed in the first dimension of the array and the rows are placed in the second dimension.

In comparison, the similar GetString method returns a specified Recordset as a string.

There are three optional parameters.

GetRowsOptionEnum Constants
Note as of ADO version 2.5, there is only one value in this table.
 

Constant Value Description
adGetRowsRest -1 Default, retrieves all records from the designated starting point to the end of the records

 
BookmarkEnum Constants
 
Constant Value Description
adBookmarkCurrent 0 Default, start search at current record
adBookmarkFirst 1 Start search at first record
adBookmarkLast 2 Start search at last record

Examples

Code:
avarGetRowsArray = objRecordset.GetRows(intNumRows, BkMrk)

See Also: