Basic procedure (C++Builder)

<< Click to Display Table of Contents >>

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

Basic procedure (C++Builder)

Previous pageReturn to chapter overviewNext page

These are the basic steps required to get a field value from a table:

1.Initialize the Borland Database Engine

2.Open a database object

3.Set the database object to point to the directory containing the table

4.Set the directory for temporary objects

5.Open a table, creating a cursor object

6.Get the properties of the table

7.Using these properties, allocate memory for a record buffer

8.Position the cursor on the desired record

9.Get the desired record from the cursor (table)

10.Get the desired fields from the record

11.Free all resources

Click on each numbered step to display a detailed explanation and a specific code sample.

At any time, you can refer to the Template program which demonstrates, in the context of a fully functional program, each of the steps in the basic procedure. You can copy and paste from this code to build your own BDE programs.

Note that throughout the short examples unfamiliar variable types are used. These are BDE variable types defined in the BDE wrapper header file, such as: CURProps and hDBICur.

For error-handling, all BDE API functions in this demonstration are called through the C++Builder function Check, defined in the DBTables unit. The Check function traps exceptions that occur on calling the enclosed BDE API function and provide fundamental error message reporting through a simple dialog. See the C++Builder online help for more information on the Check function. When using the Check function in a program, be sure to include the DBTables unit.

 

hmtoggle_plus1Application Development