The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.



Obtains the bookmark value for the current record.

      void GetBookmark( 
   CDBVariant& varBookmark  


A reference to a CDBVariant object representing the bookmark on the current record.

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.


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.


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).

This method can throw exceptions of type CDBException* and CMemoryException*.

Exception Condition


Header: afxdb.h