Condividi tramite


Managing a Database

After creating a database, you might want to add it to a project if it isn't already part of one. If your database is already part of a project, you can remove it from a project. Also, if you no longer need the database, you can delete it from the disk.

Adding a Database to a Project

When you create a database with the CREATE DATABASE command, the database is not automatically a part of a project, even if the Project Manager is open. You can add the database to a project to make it easier to organize, view and manipulate database objects through the interface, as well as to simplify the process of building an application. You can add a database to a project only through the Project Manager.

To add a database to a project

Removing a Database from a Project

You can remove a database from a project only through the Project Manager.

To remove a database from a project

  • In the Project Manager, select the database and choose Remove, and then choose Remove again.

Deleting a Database

You can delete a database from disk using the Project Manager or the DELETE DATABASE command.

To delete a database

For example, the following code deletes the sample database:

DELETE DATABASE sample

Always use one of the methods above to delete a database from disk. Using the Project Manager or the DELETE DATABASE command enables Visual FoxPro to remove backlinks to the database from the tables in a database. If you use another file manipulation utility to delete a database file, such as the Windows Explorer, these backlinks are not removed.

Note   The DELETE DATABASE command does not delete the tables associated with a database from the disk; rather, the tables that were associated with the database become free tables. If you want to delete both a database and all its associated tables from disk, use the DELETETABLES clause with the DELETE DATABASE command.

See Also

Validating a Database | Referencing Multiple Databases | CREATE DATABASE | Project Manager | Viewing and Modifying Database Architecture | Creating Databases | Working with a Database