Microsoft SDK for Java

getAbsolutePosition

The getAbsolutePosition and setAbsolutePosition methods of the Recordset class move to a record based on its ordinal position in the Recordset object, or set the ordinal position of the current record, respectively.

Syntax

public int getAbsolutePosition();
public void setAbsolutePosition(int pos);

Return Value

Sets or retrieves a value from 1 to the number of records in the Recordset object, or retrieves one of the AdoEnums.Position values.

Parameters

pos The desired ordinal position of the current record.

Remarks

The provider must support the appropriate functionality for this property to be available.

Like getAbsolutePage, getAbsolutePosition is 1-based and equals 1 when the current record is the first record in the Recordset. You can obtain the total number of records in the Recordset object from getRecordCount.

When you set the absolute position, even if it is to a record in the current cache, ADO reloads the cache with a new group of records starting with the record you specified. The getCacheSize method determines the size of this group.

Note   Do not use the absolute position as a surrogate record number. The position of a given record changes when you delete a preceding record. There is also no assurance that a given record will have the same absolute position if the Recordset object is requeried or reopened. Bookmarks are still the recommended way of retaining and returning to a given position and are the only way of positioning across all types of Recordset objects.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.