>My application works on 2 PCs over the network. The database is located on one of them. On the second one from time to time the "Error Reading file" appears. It happens rearly, once or twice per week, but often enough to piss off the customer :-(
>
>It definately related to network troubles. But the application pulls the data from 4 TCP devices 5 times per second and does not loose the connections when the problem happens. Probably the network drops for split of a second. Just enough to screw the VFP up.
>
>Questions:
>1) How to get rid of "Error Reading file"?
>2) How to make VFP more stable on the network?
Fix the network. No other advice. Sometimes it's loose cable plugs, sometime it's the network card, sometimes it's a cable going too close to a source of electrical noise (welding, huge motors being turned on/off, x-ray machine - seen them all).
>3) Is it any way to recover after the "Error Reading file" without restarting the Application?
I thought not, but Arto's code seems to be the best answer to that that I saw so far.
One thing that I found that at least saves the tables from corruption, was to reopen the table(s) in another instance of Fox (this was in FPD2.6, mind you - haven't seen this error since), update a record and close the table. Nowadays, you could possibly do that within the same instance of the app - close the dbc, tablerevert() any buffers etc, then reopen the tables, do a little change, save, undo change, save. Having that done in a separate datasession would probably be even better.
This technique somehow forced the OS to flush the buffers to disk even on the stuck FP app, so nothing was lost, except maybe the unfinished document they were typing at the moment. But then, there was no way then, in FPD2.6, to salvage the app - it had to be killed.