Validate Database
This command is a rescue mission. It lets you check whether a database is damaged and, as much as possible, repair the damage. Usage | VALIDATE DATABASE [ RECOVER ] [ NOCONSOLE ] [ TO PRINT [ PROMPT ] | TO [ FILE ] FileName [ ADDITIVE ] ] |
![]() | In versions prior to VFP 7, VALIDATE DATABASE RECOVER was available only from the Command Window. Using it in a program resulted in an error message. Fortunately, in VFP 7, this command can be used in code, so it's available in a runtime environment. Of course, since this is a potentially dangerous command (it can remove tables from a database, for example) and it displays dialogs that are confusing to the typical end-user ("What is a backlink and why would I want to update or remove it?"), you'll want to use it only in "administrator" functions in your applications. |
Example | CREATE DATABASE ValTest CREATE TABLE Test1 (cFld C(1)) INDEX ON cFld TAG cFld USE CREATE SQL VIEW TestView AS SELECT * FROM Test1 * Okay, now we've got data. Validate. VALIDATE DATABASE && Displays "Database container is valid" * Now let's see what kind of trouble we can cause CLOSE DATA DELETE FILE Test1.CDX USE ValTest.DBC LOCATE FOR ObjectType="View" REPLACE ObjectType WITH "Not a View" USE * Now open the database again and see what happens OPEN DATA ValTest EXCLUSIVE VALIDATE DATABASE && Reports lots of problems VALIDATE DATABASE RECOVER && Prompts you to fix things up |
See Also | AfterValidateData, BeforeValidateData, Open Database, Remove Table, Set Database |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.