Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Camil Ghircoias
  Where is Camil Ghircoias?
 Sibiu
 Romania
 Camil Ghircoias
 To: ursula
  Where is ursula?
 jakarta
 Indonesia
 ursula
 Tags
Subject: RE: Need advise about corrupted dbf
Thread ID: 233151 Message ID: 233160 # Views: 66 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, June 30, 2009 12:33:53 PM         
   


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



COMPLETE THREAD
Need advise about corrupted dbf Posted by ursula @ 6/30/2009 11:20:57 AM
RE: Need advise about corrupted dbf Posted by Camil Ghircoias @ 6/30/2009 12:33:53 PM
RE: Need advise about corrupted dbf Posted by ursula @ 7/2/2009 11:23:28 AM
RE: Need advise about corrupted dbf Posted by Camil Ghircoias @ 7/2/2009 12:03:26 PM
RE: Need advise about corrupted dbf Posted by ursula @ 7/3/2009 6:16:18 AM
RE: Need advise about corrupted dbf Posted by Boudewijn Lutgerink @ 6/30/2009 3:08:51 PM
RE: Need advise about corrupted dbf Posted by Yuri Rubinov @ 6/30/2009 3:45:15 PM