CRecordset::SetAbsolutePosition

void SetAbsolutePosition( long nRows );
throw( CDBException, CMemoryException );

Parameters

nRows

The one-based ordinal position for the current record in the recordset.

Remarks

Call this member function to position the recordset on the record corresponding to the specified record number. SetAbsolutePosition moves the current record pointer based on this ordinal position.

Note   This member function is not valid on forward-only recordsets.

For ODBC recordsets, an absolute position setting of 1 refers to the first record in the recordset; a setting of 0 refers to the beginning-of-file (BOF) position.

You can also pass negative values to SetAbsolutePosition. In this case the recordset's position is evaluated from the end of the recordset. For example, SetAbsolutePosition( -1 ) moves the current record pointer to the last record in the recordset.

Note   Absolute position is not intended to be used as a surrogate record number. Bookmarks are still the recommended way of retaining and returning to a given position, since a record's position changes when preceding records are deleted. In addition, you cannot be assured that a given record will have the same absolute position if the recordset is re-created again because the order of individual records within a recordset is not guaranteed unless it is created with an SQL statement using an ORDER BY clause.

For more information about recordset navigation and bookmarks, see the articles Recordset: Scrolling (ODBC) and Recordset: Bookmarks and Absolute Positions (ODBC) in Visual C++ Programmer’s Guide.

CRecordset OverviewClass MembersHierarchy Chart

See Also   CRecordset::SetBookmark