> Hi all,
>
> I need your advise. I always face corrupted dbf even though I have put syntax
close tables
at query unload method in the form itself. It usually happens when the electricity down, so that the software is not turned off properly. Then I tried to search in foxite about corrupted table and I got a solution in thread id # 171129. It is stated for corrupted table, I just use this syntax below
>
>
SET TABLEVALIDATE TO 0
> USE corrupted_table
> APPEND BLANK
> Delete && I add it by myself because I don’t want if it will effect the number of the records
> Pack && I add it by myself because I don’t want if it will effect the number of the records
> USE
>
> I tried that syntax above and my corrupted tables are really fixed
>
> I am just asking if I put that syntax above at init in main form, is it fine? What I mean is, will it effect to the data or make the software run very slow or just repairing the table structure only instead of the data inside the tables or make something bad? If by adding that syntax would not effect bad thing to my tables, I will put it at init form and use that code for every software that I make.. I really2 almost go crazy because of the corrupted dbf.
>
> Thanks a lot :)
>
> Ursula
It is not good because it will be impossible for 2 users to work simultaneosly and it will work like an elephant. A good solution is this:
At the beggining of your app make a procedure for checking if any table is corrupted.
set tablevalidate to 1
try
use yourtable shared && shared otherwise you will have to exit all users even the table is not corrupted
catch to oException
if oException.errorno=the error number for tablecoruption
messagebox("there is a corrupted table, ask for other people to exit the app")
use your table exclusive
do your delete pack
* or another solution:
alter table yourcorrupted table add column xxx c(1)
alter table yourcorrupted table drop column xxx
endif
endtry
if used("yourtable")
use in yourtable
endif
Camil Ghircoias
Vfp likes me.