Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to fix or recover corrupted dbf file
Message
 
To
10/07/2009 06:42:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01411355
Message ID:
01411374
Views:
55
Hi Mark,

Calculate the maximum number of records supported by VFP:
Int((2^31-Header()-2)/(Recsize()+1)) 
Then use FOPEN() and FCHSIZE() to change the size to:
nMax*RECCSIZE()+HEADER()
Finally fix the number of records in the header:
lnFile = FOPEN("table.dbf",2)
FSEEK(lnFile,4)
FWRITE( lnFile, BinToC(nMax,"RS"))
FCLOSE(lnFile)
Finally recreate all indexes. Make sure you do all this on a copy. If you have additional records in the table, you might need to recover them from the file. You can use FOPEN(), FSEEK() and FREAD for this.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform