C Examples: DbiOpenFieldList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiOpenFieldList

Return to chapter overview

Get the field names for the specified table:

For standard tables, the extension must be specified. The Fields variable must have sufficient space allocated for function to use. This example uses the following input:
         fDbiOpenFieldList(hDb, "customer.db", FieldNames);

DBIResult fDbiOpenFieldList(hDBIDb hTmpDb, pCHAR TblName, pCHAR Fields)

{

   FLDDesc       FldDesc;

   DBIResult     rslt;

   hDBICur       hTmpCur = 0;

   Fields[0] = '\0';

   rslt = Chk(DbiOpenFieldList(hTmpDb, TblName, NULL, FALSE, &hTmpCur));

   while (DbiGetNextRecord(hTmpCur, dbiNOLOCK, (pBYTE)&FldDesc, NULL) == DBIERR_NONE)

   {

      strcat(Fields, FldDesc.szName);

      strcat(Fields, "  ");

   }

   if (hTmpCur != 0)

      DbiCloseCursor(&hTmpCur);

   return rslt;

}