How to: Create Databases

You can use a wizard to create a database and add tables, or you can create an empty database container. A wizard helps you create a database using your answers to a series of questions. The wizard also provides templates for tables and views, indexes, primary keys, and relationships you can choose or edit.

When you create a database, a database (.dbc) file is created with an associated database memo (.dct) file and database index (.dcx) file.

To create a database using a wizard

  1. On the File menu, click New.

  2. In the New dialog box, click Database, and then Wizard.

  3. Follow the instructions on the wizard screens.

For more information, see Database Wizard.

You can also begin the wizard from a project in the Project Manager by expanding the Data node, selecting the Databases node, clicking New, and then Database Wizard. For more information, see Project Manager Window.

To create an empty database container

  1. On the File menu, click New.

  2. In the New dialog box, click Database, then New file.

  3. In the Create dialog box, browse to the location you want to save the database, type a name for the database, and click Save.

    The Database Designer opens and displays an empty database.

For more information, see Database Designer (Visual FoxPro).

To create a database in a project

  1. Open the project in the Project Manager.

  2. In the Project Manager, expand the Data node, and click the Databases node.

  3. Click New, and then New Database.

For more information, see Project Manager Window.

To create a database programmatically

  • Use the CREATE DATABASE command.

    The following example creates and exclusively opens a database named Sample:

    CREATE DATABASE Sample
    

For more information, see CREATE DATABASE Command.

Note

Using the CREATE DATABASE command does not add the database automatically to a project even when the Project Manager is open. For more information, see How to: Add Databases to Projects.

See Also

Reference

Databases in Visual FoxPro

Other Resources

Working with Items in Databases
Creating Databases