Step 10: Get the desired fields from the record

<< Click to Display Table of Contents >>

Navigation:  Application development > Introduction to BDE programming > BDE Programming in Borland C/C++ > Basic procedure >

Step 10: Get the desired fields from the record

Previous pageReturn to chapter overviewNext page

Now you are ready to get the field values out of the record buffer and into some local variables.

In this example, we are making assumptions about which field is at which ordinal position within the table, as well as the size of the field.

The table used by this example is CUSTOMER.DB, included with the BDE SDK.

In general, it is recommended to use DbiGetFieldDescs to get information about a field before retrieving it. Also note that a single function, DbiGetField, is used to get all fields (other than BLOBs) from a table.

 

DFLOAT                custNum;

BOOL                                isBlank;

 

Chk(DbiGetField(

   hCur,                                          // Cursor which contains the record

   1,                                // Field Number of the "Customer" field.

   pRecBuf,                                        // Buffer containing the record

   (pBYTE)&custNum,                                // Variable for the Customer Number

   isBlank));                                                // Is the field blank?