Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
MODIFY DATABASE
This command opens the Database Designer to let you interactively change the structure of a database (DBC).
MODIFY DATABASE [ Name | ? ] [ NOWAIT ] [ NOEDIT ]
If both Name and the “?” are omitted, the current database is opened. If there is no current database, the Open dialog lets you choose one. If Name isn’t open, MODIFY DATABASE
opens it, sets it as the current database, and brings up the Database Designer. Note that, in this case, the current setting of EXCLUSIVE determines whether you’ll actually be able to make any changes.
In VFP 7, if the database has Database Events
turned on, the ModifyData event fires.
Be careful what you assume with MODIFY DATABASE
. When you USE a table that’s part of a database, the database gets opened automatically, but does not become the current database. If you then MODIFY DATABASE
<that database name>, you’d expect to see the OPEN DATABASE
. However, if you’re in a different directory and the directory containing the database isn’t in your FoxPro path, you’ll actually be creating a new database in the current directory.
NOWAIT lets you open the Database Designer in a program and leave it waiting while you issue other commands.
NOEDIT allows you to view the database schema, but prevents you from inadvertently making changes to it. Be aware that the NOEDIT keyword isn’t as strong as the NOUPDATE keyword of OPEN DATABASE
. Although you can’t visually add and remove things from the database, you can do so programmatically.
When you use NOEDIT, you shouldn't be able to edit the stored procedures for the database, and you can't if you choose Edit Stored Procedures from the Database or shortcut menus (the code editor window is read-only). However, if you bring up the Properties window for the database and double-click on one of the database events in the list, the code editor window that comes up isn't read-only and will allow you to save any changes you make. |
MODIFY DATABASE MyData