Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Before you open the rowset, you must tell the provider that you want to use bookmarks. To do this, set the DBPROP_BOOKMARKS property to true in your property set. The provider retrieves bookmarks as column zero, so you must use the special macro BOOKMARK_ENTRY and the CBookmark class if you’re using a static accessor. CBookmark is a templated class where the argument is the length in bytes of the bookmark buffer. The length of the buffer required for a bookmark depends on the provider. If you are using the ODBC OLE DB provider, as shown in the following example, the buffer must be 4 bytes.
class CProduct
{
public:
CBookmark<4> bookmark;
BEGIN_COLUMN_MAP(CProduct)
BOOKMARK_ENTRY(bookmark)
END_COLUMN_MAP()
};
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_BOOKMARKS, true);
CTable<CAccessor<CProduct> > product;
product.Open(session, "Products", &propset);
If you use CDynamicAccessor, the buffer is dynamically allocated at run time. In this case, you can use a specialized version of CBookmark for which you do not specify a buffer length. Use the function GetBookmark to retrieve the bookmark from the current record, as shown here:
CTable<CDynamicAccessor> product;
CBookmark<> bookmark;
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_BOOKMARKS, true);
product.Open(session, "Products", &propset);
product.MoveNext();
product.GetBookmark(&bookmark);