CRecordset::GetBookmark
Obtains the bookmark value for the current record.
void GetBookmark(
CDBVariant& varBookmark
);
Parameters
- varBookmark
A reference to a CDBVariant object representing the bookmark on the current record.
Remarks
To determine if bookmarks are supported on the recordset, call CanBookmark. To make bookmarks available if they are supported, you must set the CRecordset::useBookmarks option in the dwOptions parameter of the Open member function.
Note
If bookmarks are unsupported or unavailable, calling GetBookmark will result in an exception being thrown. Bookmarks are not supported on forward-only recordsets.
GetBookmark assigns the value of the bookmark for the current record to a CDBVariant object. To return to that record at any time after moving to a different record, call SetBookmark with the corresponding CDBVariant object.
Note
After certain recordset operations, bookmarks may no longer be valid. For example, if you call GetBookmark followed by Requery, you may not be able to return to the record with SetBookmark. Call CDatabase::GetBookmarkPersistence to check whether you can safely call SetBookmark.
For more information about bookmarks and recordset navigation, see the articles Recordset: Bookmarks and Absolute Positions (ODBC) and Recordset: Scrolling (ODBC).
Exceptions
This method can throw exceptions of type CDBException* and CMemoryException*.
Requirements
Header: afxdb.h
See Also
Reference
CDatabase::GetBookmarkPersistence