Step 6: Get the properties of the table

<< Click to Display Table of Contents >>

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

Step 6: Get the properties of the table

Previous pageReturn to chapter overviewNext page

To get record information from the table, you need to determine the size of the record buffer. This is one of the cursor properties returned by the DbiGetCursorProps function. Other properties you can use DbiGetCursorProps to retrieve include the table name, the size of the table, and the number of fields in the table.

In this example, the table for which properties are retrieved is specified in the variable hCur (set in the example for DbiOpenTable). DbiGetCursorProps returns properties into a structure of type CURProps, here, the variable named CursorProps. The iRecBufSize field of this structure contains the record size. The record size retrieved here is needed in the next step where the record is read from the table into a memory buffer.

void __fastcall TForm1::Button1Click(TObject *Sender)

{

 …

 CURProps curProps; // Properties of the cursor

 …

 Check(DbiGetCursorProps(

   hCur,       // Handle to the cursor

   curProps)); // Properties of the cursor (table)

 …

}