Hi!
First of all, find a better generator for your primary ID keys. It should not be just
SELECT max(ID)+1 as NewID ...
because the problem you just described. As for example, take a look to the Tom Dill's FAQ article at the
www.tek-tips.com site (VFP forum) about auto-incremet ID key value generating for VFP databae tables.
Another thing is use transactions in all places that write data. After ending transaction always use FLUSH command. Trying to lock a table just after finishing the transaction and immediately unlocking it also usually helps to flush internal Windows and Novell system cache buffers that also decrease a risk of corruption when application crash.
HTH.
>I now responsible for an existing multi-user VFP application (currently VFP 5, willing to use newer versions). Tables are on a server (Novel).
>It opens all the tables when the application starts (a hold over from original FPW opplication), it uses private data sessions for data entry forms. Recent a user crashed and I think this currupted a few tables but adding an empty record which caused the part of creates the keys to restart at 1 and thus create duplicate records. I was able to fix this by deleting bad records, but this may have caused some counts in other tables to be bad.
>
>I do not want to be in the table repair bussiness and thus would like to avoid situations like this. Any suggestions appreciated.
>
>One thought I had to minimize potentail bad records is NOT open the tables when application starts but only when data is being added or updated. Is this a viable approach?
>
>What is the overhead?
>How do I code this efficiently?
>
>FWIW it uses SDT.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.