Microsoft KB Archive/236656

= PRB: Transactions Can Fail with No Error Message on Corrupt Tables =

Q236656

-

The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a, 6.0

-

SYMPTOMS
In some cases, when adding records to a table within a transaction, the record will not be added to the table after the transaction has ended. This occurs even though there are no errors reported and, if buffering is in use, the TableUpdate function might even return True (.T.).

CAUSE
This behavior occurs if the table header for the table is corrupted.

RESOLUTION
The following code can be used to check the table header and size of the table to help uncover possible corruption:

USE mytable x=SET("Compatible") SET COMPATIBLE ON IF (HEADER + RECSIZE* RECCOUNT+1) # FSIZE(DBF) WAIT WINDOW "table is corrupt" ELSE WAIT WINDOW "table is ok" ENDIF SET COMPATIBLE &x USE In the code above, the FSIZE function returns the size of a table file if Compatible is set on. For more information on FSIZE, see the Visual FoxPro Online Help file.

MORE INFORMATION
In some cases where this problem occurs, records can be added to the table successfully if transaction processing is not used. When buffering is used, the TableUpdate function will even return True (.T.), indicating that the record was successfully placed in the table. Records can also be added successfully to the table with no buffering.