Microsoft KB Archive/130305

= PRB: Error: "The Fields in Table Did Not Match..." =

Article ID: 130305

Article Last Modified on 2/10/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q130305



SYMPTOMS
When opening a database-owned table you receive this error;

The fields in table " " did not match the entries in the database.



CAUSE
When a database-owned table is opened, Visual FoxPro tries to confirm that each field of the table has a matching field object in the database. When the entries do not match, the error occurs. This error can be caused by a corrupt database or a corrupt table. It may also be caused by having the wrong copy of a table (.DBF) in the same directory as a parent database (.DBC).



RESOLUTION
Begin by using the VALIDATE DATABASE command to check the integrity of the current database. Open the database exclusively, and issue the VALIDATE DATABASE command from the Command window, for example: OPEN DATABASE mydata EXCLUSIVE VALIDATE DATABASE If the database itself cannot be opened, the database is probably corrupt and must be recreated, recovered using a program previously created using GENDBC.PRG, or recovered by using a third-party database recovery tool.

For more information about recovering a corrupt database, please see the following article in the Microsoft Knowledge Base:

129168 How To Recover Corrupt Database Container Files

If a table is corrupt or invalid, the VALIDATE DATABASE command gives the name of the offending table and its diagnosis. For example, "The fields in table ' ' did not match the entries in the database."

If the wrong version of the table (.DBF) accidentally replaced a previous version, the previous version must be recovered (see the "Steps to Reproduce Behavior" section in this article). Otherwise, the table must be deleted or removed from the database container file and, if desired, added back to the database.

To remove the table, issue the VALIDATE DATABASE RECOVER command or the REMOVE TABLE command and specify the table name.

The VALIDATE DATABASE RECOVER and REMOVE TABLE commands have the same affect on the offending table, the table is removed from the database but remains on the disk. Any field properties and long field names defined in the table are lost when the table is removed.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
The steps outlined below describe how to generate the error using an incorrect version of a table (.DBF) file.

  Open or create a new database: CREATE DATABASE mydata   Add a new table (named mytab1) to the database. Give the table one character field named cField1 with a length of 20: CREATE TABLE mytab1 (cField1 C(20))  Save and close the table and database. Create a new database. Place the new database into a separate directory from the one created in step 1. Add a new table (named 'mytab1') to the new database, and be sure the table is saved to the same directory as the current database. Give the new table three or four fields of any data type.</li> Save and close the database.</li> Copy or move the MYTAB1.DBF file created in step 5 to the directory where the first MYTAB1.DBF was created in step 2. Overwrite the table created in step 2.</li> From the Command window, open the database created in Step 1 to see the error displayed.</li></ol>

Additional query words: VFoxWin

Keywords: KB130305

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.