JetGotoBookmark() public static method

Positions a cursor to an index entry for the record that is associated with the specified bookmark. The bookmark can be used with any index defined over a table. The bookmark for a record can be retrieved using JetGetBookmark.
public static JetGotoBookmark ( JET_SESID sesid, JET_TABLEID tableid, byte bookmark, int bookmarkSize ) : void
sesid JET_SESID The session to use.
tableid JET_TABLEID The cursor to position.
bookmark byte The bookmark used to position the cursor.
bookmarkSize int The size of the bookmark.
return void
Example #1
0
        /// <summary>
        /// Update the tableid and position the tableid on the record that was modified.
        /// This can be useful when inserting a record because by default the tableid
        /// remains in its old location.
        /// </summary>
        /// <remarks>
        /// Save is the final step in performing an insert or an update. The update is begun by
        /// calling creating an Update object and then by calling JetSetColumn or JetSetColumns one or more times
        /// to set the record state. Finally, Update is called to complete the update operation.
        /// Indexes are updated only by Update or and not during JetSetColumn or JetSetColumns
        /// </remarks>
        public void SaveAndGotoBookmark()
        {
            var bookmark = Caches.BookmarkCache.Allocate();
            int actualBookmarkSize;

            this.Save(bookmark, bookmark.Length, out actualBookmarkSize);
            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, actualBookmarkSize);
            Caches.BookmarkCache.Free(ref bookmark);
        }
Example #2
0
        /// <summary>
        /// Update the tableid and position the tableid on the record that was modified.
        /// This can be useful when inserting a record because by default the tableid
        /// remains in its old location.
        /// </summary>
        /// <remarks>
        /// Save is the final step in performing an insert or an update. The update is begun by
        /// calling creating an Update object and then by calling JetSetColumn or JetSetColumns one or more times
        /// to set the record state. Finally, Update is called to complete the update operation.
        /// Indexes are updated only by Update or and not during JetSetColumn or JetSetColumns.
        /// </remarks>
        public void SaveAndGotoBookmark()
        {
            byte[] bookmark = null;

            try
            {
                bookmark = Caches.BookmarkCache.Allocate();
                int actualBookmarkSize;
                this.Save(bookmark, bookmark.Length, out actualBookmarkSize);
                Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, actualBookmarkSize);
            }
            finally
            {
                if (bookmark != null)
                {
                    Caches.BookmarkCache.Free(ref bookmark);
                }
            }
        }