Mark M wrote:
> I am sup****ting an older Delphi 4 application. It is a multi user
> application that edits and inserts records into a dBase IV DBF residing
> on a Netware server. The problem appears only once in a while, maybe
> every few days for a period of a couple of hours. The applications are
> all sharing this DBF, but sometimes adding a new record using the
> append method of a TTable object results in an existing DBF record to
> be overwritten. For example, if the DBF contains 100 records, a user
> issues an action to add a record to the file, but instead of adding a
> record to the end of the file, it overwrites one of the existing 100
> records. The code skeleton is as follows:
>
> ATable.Append;
> ATable.FieldByName('REF').AsString:= '1234';
> ATable.Post;
>
> I inserted logging into the code to tell me which dBase record was
> added, because after the ATable.Post, the record pointer should be on
> the newly added record. So my code changed to:
>
> ATable.Append;
> ATable.FieldByName('REF').AsString:= '1234';
> ATable.Post;
> // Log the adding of the record
> Logit("Added record number "+ IntToStr(ATable.Recno));
>
> The log file will show something like:
>
> ...
> Added record number 100
> Added record number 101
> Added record number 102
> Added record number 103
> Added record number 104
> Added record number 88
> Added record number 89
> Added record number 90
> ....
>
> I have turned off all file caching in the Netware client. The Netware
> client is up to date except for the W2K machines using a 2 small
> revisions old due to conflicts with another legacy application. I have
> tried to FlushBuffers after the post, and tried many many other things.
> It appears the MDX index file is getting corrupt somehow and seeks
> using the keys lead to incorrect records. I have run out of ideas, and
> all my ideas are too long to list in one posting. All workstations
> are running BDE 5.1 with all the same settings.
>
> Does anyone have any ideas?
>
years ago i ran into a similar problem..
what i did was to lock the database for exclusive
access when ever i was adding/updating records.
i would first check to see who had to lock on it
after i had locked it my self. i found that now and
then, some other user would have a lock on it and the
database would collide with no errors to the app.
in this case, i simply attempted another lock until
i got a status back indicating that my app had the
lock on it.
this may not apply to you but it worked for me. i don't
know how much flexibility you have with that DB engine.
--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5


|