Create Database, Delete Database
These commands create and destroy databases, respectively. A database is a collection of tables, views, connections and other stuff. See "DBC, DBF, FPT, CDX—Hike!" for more on what constitutes a database in Visual FoxPro.
Usage |
CREATE DATABASE [ Name | ? ] |
CREATE DATABASE ? * Change the name to Fred and choose OK CREATE DATABASE ? * Note that new database name offered is DATA2.DBCWeird, but it doesn't really matter, since you'd never want to use the default name.Creating a database opens it (exclusively). Unlike tables, databases don't use anything like work areas, so opening one doesn't close any others that are already open. However, only one database can be current at a time. The newly created database is empty and becomes the current database. You have to use commands or the Database Designer to put stuff in it.When a database is open and current, creating a new table automatically puts it in the open database.Be careful about database names. Because the database is stored as a file, you get only as many characters as the Windows version allows. Using VFP 3 in Windows 3.1, you can CREATE DATABASE AVeryLongName, but it's stored as AVeryLon.DBC.
Example |
CREATE DATABASE MyImportantData |
Usage |
DELETE DATABASE Name | ? [ DELETETABLES ] [ RECYCLE ] |
Not surprisingly, restoration of a database from the Recycle Bin doesn't work very well. When you open the restored database, it appears to contain what it did before, but the tables still think they're free tables, if you specified not to delete them as well. You have to let VFP correct the backlinks before the database works right. |
See Also |
Add Table, Close Database, Create, Create SQL View, Create Table, DBGetProp(), DBSetProp(), Modify Database, Open Database, Pack Database, Set Database, Set Safety, Validate Database |