Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add and delete dbf in dbc
Message
 
 
To
29/03/2005 04:05:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00999614
Message ID:
00999624
Views:
38
>Dear Experts
>
>There is a dbf, out2, in dbc entitled Weight
>Sometimes this out2.dbf has errors, as a result I have to face the following error message
>
>"Error reading file"
>
>
>Then there is an original copy of out2.dbf located in the ORIGINAL folder in the same directory. I copy out2.dbf from origional folder and paste in TABLES folder. Then everything works fine.
>
>My question is: how to programatically delete out2.dbf from Weight.dbc and Add out2.dbf, from Original folder, to Weight.DBC.
>
>Or is there any other solution to get rid of error message
>
>"Error reading file"
>
>Please help

I got just the same error but the reason wasn't error/corrupted DBF but VFP wasn't able to read DBC (because of broken connection). If you have DBF opened as SHARED (EXCLUSIVE OFF) and when "error reading file" occurs, open another VFP where open the out2.dbf (in weight.dbc) again. If you can open out2.dbf you have probably same situation than I had.

Another way to test it (+ fix), is that when the error "error reading file" occurs, open the command window and run the goarounderr1104.prg as follows:

USE goarounderr1104("HD:\path\", "out2")

where HD:\path\ is the path to your weight.DBC
*!* goarounderr1104.prg
LPARAMETER cPATH, cTable

LOCAL ;
  laDBC[1,2], ;
  lni, ;
  lnCount, ;
  lcDBC

m.lcDBC = ""
 
adatabase(laDBC)

m.lni = ALEN(laDBC,1)

IF m.lni > 0
  FOR m.lnCount = 1 TO m.lni
    IF AT(upper(cPATH),upper(laDBC(m.lnCount,2))) > 0
      m.lcDBC = laDBC(m.lnCount,2)
      exit
    Endif
  Endfor
  If !EMPTY(m.lcDBC)
     SET DATABASE TO (m.lcDBC)
     CLOSE DATABASE 
  Endif   
Endif

Return cTable
above is also the "fix" to the "error reading file" if it happens because of DBC.

AT
Previous
Reply
Map
View

Click here to load this message in the networking platform