Delphi Examples: DbiSetToKey

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiSetToKey

Return to chapter overview

Find the specified value in the table and return the record and record buffer

This example works with the STOCK.DB table open on the primary key and uses the following input:

 fDbiSetToKey(hCur, pRecBuf);

 

The function is:

function fDbiSetToKey(hTmpCur: hDBICur; pTmpRecBuf: PByte): Longint;

var

 key: Double;

 RecProp: RecProps;

begin

 key:= 1330.00;

 Check(DbiInitRecord(hTmpCur, pTmpRecBuf));

 Check(DbiPutField(hTmpCur, 1, pTmpRecBuf, @key));

 Check(DbiSetToKey(hTmpCur, keySEARCHEQ, False, 0, 0, pTmpRecBuf));

 Check(DbiGetNextRecord(hTmpCur, dbiNoLock, pTmpRecBuf, @RecProp));

 Result := RecProp.iSeqNum;

end;