CRecordset::SetRowsetCursorPosition
Moves the cursor to a row within the current rowset.
void SetRowsetCursorPosition(
WORD wRow,
WORD wLockType = SQL_LOCK_NO_CHANGE
);
Parameters
wRow
The one-based position of a row in the current rowset. This value can range from 1 to the size of the rowset.wLockType
Value indicating how to lock the row after it has been refreshed. For details, see Remarks.
Remarks
When implementing bulk row fetching, records are retrieved by rowsets, where the first record in the fetched rowset is the current record. In order to make another record within the rowset the current record, call SetRowsetCursorPosition. For example, you can combine SetRowsetCursorPosition with the GetFieldValue member function to dynamically retrieve the data from any record of your recordset.
To use SetRowsetCursorPosition, you must have implemented bulk row fetching by specifying the CRecordset::useMultiRowFetch option of the dwOptions parameter in the Open member function.
SetRowsetCursorPosition calls the ODBC API function SQLSetPos. The wLockType parameter specifies the lock state of the row after SQLSetPos has executed. The following table describes the possible values for wLockType.
wLockType |
Description |
---|---|
SQL_LOCK_NO_CHANGE (the default value) |
The driver or data source ensures that the row is in the same locked or unlocked state as it was before SetRowsetCursorPosition was called. |
SQL_LOCK_EXCLUSIVE |
The driver or data source locks the row exclusively. Not all data sources support this type of lock. |
SQL_LOCK_UNLOCK |
The driver or data source unlocks the row. Not all data sources support this type of lock. |
For more information about SQLSetPos, see the Windows SDK. For more information about bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).
Requirements
Header: afxdb.h