Share via


Viewing and Modifying Database Architecture

When you create a database, Visual FoxPro creates and exclusively opens a .dbc (DataBase Container) file. The .dbc file stores all the information about the database, including the names of files and objects associated with it. The .dbc file does not physically contain any top-level objects such as tables or fields. Rather, Visual FoxPro stores file path pointers to the tables in the .dbc file.

To examine the architecture of your database, you can browse the database file, view the schema, browse the database objects, validate the database, and even extend the .dbc file.

Viewing the Database Schema

The database schema is a visual representation of the table structures and persistent relationships established in your database. The Database Designer window displays the schema of the open database.

To view the database schema

  • Use the MODIFY DATABASE command.

For example, the following code opens the testdata database and displays the schema in the Database Designer:

MODIFY DATABASE testdata

From the Database Designer, you can use the Database toolbar to create a new table, add an existing table to the database, remove a table from the database, or modify the structure of a table. You can also create connections and edit stored procedures.

Browsing the Database File

The database file contains a record for each table, view, index, index tag, persistent relationship, and connection associated with the database, as well as for each table field or view field having extended properties. It also includes a single record that contains all the stored procedures for the database.

For more information, see Table File Structure.

While the Database Designer provides a conceptual representation of the database schema, sometimes you might need to browse the contents of the database file itself. You can browse a closed database by issuing the USE command on the .dbc file. The following example opens a Browse window displaying the contents of the sales database in table form.

CLOSE DATABASE sales
USE sales.dbc EXCLUSIVE
BROWSE 

Caution   Don't use the BROWSE command to alter the database file unless you are knowledgeable about the structure of the .dbc file. If you make an error while attempting to change the .dbc file you can invalidate the database and potentially lose data.

See Also

Viewing and Setting Database Properties | Extending Database Files | Database Designer | MODIFY DATABASE | Validating a Database | Developing Databases | Working with a Database