>Occasionally, in our application,(VFP5) some of our clients receive error message 114 (Index does not match the table. Delete the index file and recreate the index). We have tried two ways to solve this programmatically. First, A DELETE TAG ALL command will delete the .CDX file, but only if the table is open (and we can’t open the table because of error 114). Secondly, we’ve tried to use the DELETE FILE command to delete the .CDX file, but since the table has a primary key, when we attempt to open the table, we receive the error “Primary key property is invalid; please validate the database
>
>What’s the best way to open a table in this situation so that we can subsequently re-create the corrupted index? Our re-index routine is fairly complete, in that it creates all the necessary indexes, persistent relations, and re-creates the RI code – it’s just that we can’t get the table open without doing it manually in VFP.
If possible, backup all and try to re-fill the table!
Then, the index problem will be auto-fixed.
Example code:
Use DataTable EXCLUSIVE
SELECT * from DataTable Where .T. INTO CURSOR Tmp
SELECT DataTable
ZAP
APPEND FROM DBF([Tmp])
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.