home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
source
/
tpwpxeng
/
srchkey.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-07-22
|
940b
|
39 lines
program SrchKey;
uses PXEngine, WinCrt;
const TableName = 'Table';
Search = 'SearchString';
var PxErr: Integer;
TblHandle: TableHandle;
RecHandle: RecordHandle;
FldHandle: FieldHandle;
NFlds: Word;
procedure PX(Code : integer);
begin
writeln(PXErrMsg(Code));
end;
begin
PX(PXWinInit('MyApp', pxShared));
NFlds := 1;
PX(PXTblOpen(TableName, TblHandle, 0, False));
PX(PXRecBufOpen(TblHandle, RecHandle));
PX(PXFldHandle(TblHandle, 'Alpha Field', FldHandle));
PX(PXPutAlpha(RecHandle, FldHandle, Search));
(* Search for match on a key *)
PxErr := PXSrchKey(TblHandle, RecHandle, NFlds, SearchFirst);
if PxErr <> PxSuccess then
if PxErr = PxErr_RecNotFound then
Writeln('No match found')
else Writeln(PxErrMsg(PxErr))
else Writeln('Match found');
PX(PXRecBufClose(RecHandle));
PX(PXTblClose(TblHandle));
PX(PXExit);
end.