C Examples: DbiDeleteRecord

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiDeleteRecord

Return to chapter overview

Delete the current record.

If Pack is set to true and the cursor is open exclusively on a dBASE or FoxPro table, the table is packed. This example uses the following input:
         fDbiDeleteRecord(hdBASECur, pRecBuf, TRUE);

DBIResult fDbiDeleteRecord(hDBICur hTmpCur, pBYTE pTmpRecBuf, BOOL Pack)

{

   DBIResult        rslt;

   CURProps       CurProps;

   hDBIDb           hTmpDb;

 

   rslt = Chk(DbiDeleteRecord(hTmpCur, pTmpRecBuf));

   if (rslt != DBIERR_NONE)

      return rslt;

   if (Pack == TRUE)

   {

      rslt = Chk(DbiGetCursorProps(hTmpCur, &CurProps));

      if (rslt != DBIERR_NONE)

         return rslt;

   if (strcmp(CurProps.szTableType, szDBASE) == 0)

      {

         // Get the database handle from the cursor handle

         rslt = Chk(DbiGetObjFromObj(hTmpCur, objDATABASE, &hTmpDb));

         if (rslt != DBIERR_NONE)

            return rslt;

         rslt = Chk(DbiPackTable(hTmpDb, hTmpCur, NULL, NULL, TRUE));

      }

   }

   return rslt;

}