Step 3: Set the database object to point to the directory containing the table

<< Click to Display Table of Contents >>

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

Step 3: Set the database object to point to the directory containing the table

Previous pageReturn to chapter overviewNext page

Now that the database is open, you must set the table directory.

Although the working directory defaults to the directory that contains the application, most applications place data in a different directory. The working directory is the directory where the BDE expects to find tables when a path is not specified.

While it is possible to open a table in other directories by specifying the absolute path, it is preferable to open tables in the working directory, because a number of operations, such as getting a list of available tables, use the current directory. Use the function DbiSetDirectory to set the working directory (using the default location of the BDE sample tables):

 

Chk(DbiSetDirectory(

   hDb,                                            // Handle to the database being modified

   "c:\\bde32\\examples\\tables"));                // The new working directory

 

Note:        You must use the full, absolute path. Relative paths are not supported.