Basic procedure (Delphi)

<< Click to Display Table of Contents >>

Navigation:  Application development > Introduction to BDE programming > BDE Programming in Delphi >

Basic procedure (Delphi)

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 unit, such as: BYTE, BOOL, and hDBICur.

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

 

hmtoggle_plus1Application Development