共用方式為


CDaoRecordset::SetBookmark

Call this member function to position the recordset on the record containing the specified bookmark.

void SetBookmark(
   COleVariant varBookmark 
);

Parameters

  • varBookmark
    A COleVariant object containing the bookmark value for a specific record.

Remarks

When a recordset object is created or opened, each of its records already has a unique bookmark. You can retrieve the bookmark for the current record by calling GetBookmark and saving the value to a COleVariant object. You can later return to that record by calling SetBookmark using the saved bookmark value.

注意

Calling Requery changes DAO bookmarks.

Note that if you are not creating a UNICODE recordset, the COleVariant object must be explicitly declared ANSI. This can be done by using the COleVariant::COleVariant( lpszSrc**,** vtSrc ) form of constructor with vtSrc set to VT_BSTRT (ANSI) or by using the COleVariant function SetString( lpszSrc**,** vtSrc ) with vtSrc set to VT_BSTRT.

For related information, see the topics "Bookmark Property" and Bookmarkable Property" in DAO Help.

Requirements

Header: afxdao.h

See Also

Concepts

CDaoRecordset Class

CDaoRecordset Members

Hierarchy Chart

CDaoRecordset::GetBookmark