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

ID: 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.


REFERENCES

For additional information about a possible cause of table header corruption, please click the article number below to view the article in the Microsoft Knowledge Base:

Q174371 Possible Database File Damage When Data Is Appended

Additional query words:

Keywords : kberrmsg kbDatabase kbVFp500 kbVFp500a kbVFp600 KbDBFDBC kbGrpFox kbDSupport
Version : WINDOWS:5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: August 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.