home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 2.ddi / CEXAM.ZIP / PUTDATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  776 b   |  33 lines

  1. #include <stdio.h>
  2. #include "pxengine.h"
  3.  
  4. #define TABLENAME        "table"
  5.  
  6. int main(void)
  7. {
  8.     TABLEHANDLE tblHandle;
  9.     RECORDHANDLE recHandle;
  10.     FIELDHANDLE fldHandle;
  11.     long date;
  12.     int month = 12, day = 5, year = 1989;
  13.     int pxErr;
  14.  
  15.     PXInit();
  16.     PXTblOpen(TABLENAME, &tblHandle, 0, 0);
  17.     PXRecBufOpen(tblHandle, &recHandle);
  18.     PXFldHandle(tblHandle, "Date Field", &fldHandle);
  19.     PXDateEncode(month, day, year, &date);
  20.  
  21.     /* Update record with new date */
  22.     if ((pxErr = PXPutDate(recHandle, fldHandle, date))
  23.     != PXSUCCESS)
  24.         printf("%s\n", PXErrMsg(pxErr));
  25.     else
  26.         PXRecUpdate(tblHandle, recHandle);
  27.  
  28.     PXRecBufClose(recHandle);
  29.     PXTblClose(tblHandle);
  30.     PXExit();
  31.     return(pxErr);
  32. }
  33.