home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include "pxengine.h"
-
- #define TABLENAME "table"
- char search[] = "SearchString";
-
- int main(void)
- {
- TABLEHANDLE tblHandle;
- RECORDHANDLE recHandle;
- FIELDHANDLE fldHandle;
- int pxErr;
- int nFlds = 1;
-
- PXInit();
- PXTblOpen(TABLENAME, &tblHandle, 0, 0);
- PXRecBufOpen(tblHandle, &recHandle);
- PXFldHandle(tblHandle,"Alpha Field",&fldHandle);
- PXPutAlpha(recHandle, fldHandle, search);
-
- /* Search for match on a key */
- if ((pxErr = PXSrchKey(tblHandle, recHandle, nFlds,
- SEARCHFIRST)) != PXSUCCESS)
- {
- if (pxErr == PXERR_RECNOTFOUND)
- printf("No match found\n");
- else
- printf("%s\n",PXErrMsg(pxErr));
- }
- else
- printf("Match found\n");
-
- PXRecBufClose(recHandle);
- PXTblClose(tblHandle);
- PXExit();
- return(pxErr);
- }