I'm trying to find out if a record exists in a table. Now, one obvious way would be to just seek for the record:
// Create correct keys for index with Api.MakeKey
Api.JetSeek(sessionId, tableId, SeekGrbit.SeekEQ);
However, this operation will set the cursor to the found record (on success), which I don't want to do. I guess I could somehow just quikly store the current record number and then set it back, but maybe there is a better solution? I couldn't find the correct method in the api.
So, is it possible to do a Exists, meaning a Seek just to check if the record exists?
By the way, I'm using .NET 4.0 with the ESENT Managed Interface 1.9.0.
Firstly, get current position of cursor using JetGetRecordPosition method
Then check if record exist as you done
or using boolean method TrySeek which returns true if a record matching the criteria was found.
Then you need to set cursor on previous position, for doing it use Api.JetGotoPosition method with recpos you got from first method.
Hope it helps.