Updating Table and Database Links

If you move database files (.dbc, .dct, and .dcx), or a table associated with a database, the relative paths change and might break the backlinks and forward links that Visual FoxPro uses to associate database and table files:

  • The backlink links the table back to the table's owning database. It consists of the relative path and file name for the .dbc file associated with the table, and is stored in the header of the Visual FoxPro table file (.dbf).
  • The forward link tells the database which tables belong to it. Forward links are stored in the database file (.dbc), and consist of the relative path and file name for each associated table file.

You can reestablish links and update the relative path information to reflect the new file location.

To update links after moving a table or a database

  • Use the RECOVER clause of the VALIDATE DATABASE command.

For example, the following code opens the testdata database and displays dialog boxes that allow you to locate tables that are not in the locations contained in the database:

OPEN DATABASE testdata
VALIDATE DATABASE RECOVER

Tip   If you want to use a table without taking time to reestablish the links for all tables in the database, you can open the table with the USE command. Visual FoxPro displays the Open dialog box to allow you to locate the owning database or delete the links.

For more information, see FREE TABLE.

See Also

Removing a Table from a Database | Creating Persistent Relationships | Adding Tables to a Database | Developing Databases | Creating a Database | Working with a Database