This article was previously published under Q168762
When index corruption happens at run time under the Foxpro 2.0, 2.5, or 2.6platforms, you can easily erase the IDX/CDX files and re-create them. Butunder the Visual FoxPro environment, once the table is bound to a databaseand it has Primary index, you cannot erase the CDX file because itgenerates "Primary key property is invalid, please validate database" errorwhen you try to open the table again in the database.
Re-creating the index on an erased CDX file that only has regular,candidate or unique index generates the following error:
Invalid database - please validate database
One option for re-creating corrupt indexes is to use GenDBC.prg to re-create your Database structure and indexes, and then restore the data backto each table. Another option is to use the following steps to restore yourcorrupted index files:
Create a table and its indexes, and bind it to a Database.
Before you input any data into the table, backup the associated .cdx file.
If the table already has data in it, copy the table to a different name and delete it. Backup its .cdx file.
When the index file becomes corrupted, copy the backup .cdx file back to the corrupted .cdx file (overwrite it).