ADO UpdateBatch Problems

From: Scott Meikle (scottm_at_isoplanNOSPAM.co.uk)
Date: 08/31/04


Date: Tue, 31 Aug 2004 14:47:29 +0100

Hello,

I'm working on an application using Delphi 7 with ADO disconnected datasets
in batch update mode with an optimistic locking strategy, sitting on top of
an
Access 2000 database. The problem that I have is in trying to handle
concurrency
errors where two people are editing the same record - calls to UpdateBatch
don't
seem to generate any exceptions when record has been changed by another
user,
with the effect that if there are two edits of the same field, the second
users changes
are always the ones that are posted - I would much rather give the user the
opportunity to merge or cancel but I can't find anywhere I can hook this in.

I have picked up various pieces of info from previous posts on similar
issues and have
tried a few different approaches. For example, I tried :
...
MyADODataSet.UpdateBatch;
MyADODataSet.Recordset.Filter := adFilterConflictingRecords;
iConflictCount := MyADODataSet.Recordset.RecordCount;
MessageDlg('There are ' + IntToStr(iConflictCount) + ' rows in conflict.',
mtWarning, [mbOK], 0);
...
I also tried :
...
MyADODataSet.UpdateBatch;
iConflictCount := MyADODataSet.Connection.Errors.Count;
MessageDlg('There are ' + IntToStr(iConflictCount) + ' rows in conflict.',
mtWarning, [mbOK], 0);
...

However, neither method yielded any results. I would appreciate any ideas as
to where I am going wrong here.

Thanks in advance,

Scott