Microsoft ActiveX Data ObjectsMicrosoft ActiveX Data Objects*
*Contents  *Index  *Topic Contents

GetRows Method - ADO

Retrieves multiple records of a Recordset into an array.

Applies To

Recordset

Syntax

array = recordset.GetRows( Rows, Start, Fields )

Return Values

Returns a two-dimensional array.

Parameters

Rows Optional. A Long expression indicating the number of records to retrieve. Default is adGetRowsRest (-1).

Start Optional. A String or Variant that evaluates to the bookmark for the record from which the GetRows operation should begin. You can also use one of the following BookmarkEnum values:
adBookmarkCurrent Start at the current record.
adBookmarkFirst Start at the first record.
adBookmarkLast Start at the last record.

Fields Optional. A Variant representing a single field name or ordinal position or an array of field names or ordinal position numbers. ADO returns only the data in these fields.

Remarks

Use the GetRows method to copy records from a Recordset into a two-dimensional array. The first subscript identifies the field and the second identifies the record number. The array variable is automatically dimensioned to the correct size when the GetRows method returns the data.

If you do not specify a value for the Rows argument, the GetRows method automatically retrieves all the records in the Recordset object. If you request more records than are available, GetRows returns only the number of available records.

If the Recordset object supports bookmarks, you can specify at which record the GetRows method should begin retrieving data by passing the value of that record's Bookmark property.

If you want to restrict the fields the GetRows call returns, you can pass either a single field name/number or an array of field names/numbers in the Fields argument.

After you call GetRows, the next unread record becomes the current record, or the EOF property is set to True if there are no more records.

Examples

GetRows Method Example (VB)


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.