Re: ADO UpdateBatch Problems

From: Dave Blake (barnswood_at_hotmail.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 18:52:36 +0100


> 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...
>

Microsoft Knowledge Base Article 190727 might be of help. More generally
http://www.adoanywhere.com/ado_faq/locking/ is a good overview.
I think you need to set update criteria to gain the control you require.
UpdateBatch collects a number of updates together to apply at one time, but
I'm not sure it checks for concurrent changes etc. Also Del is right, the
Jet OLE DB data provider (I assume you are using) does not necessarily raise
obvious exceptions. And remember that Jet does cached reads and lazy
writes - a separate connection will not see changes *immediately* after post
or commit.

But, experts out there, a good example of handling concurrency with ADO and
Delphi would be jolly nice!

Dave



Relevant Pages

  • Re: good architecture for reusing datasets
    ... implement optimistic or pessimistic concurrency. ... architecture, and database design. ... Get yourself a begineers level book on software engineering and design ... this is where the "reuse" of the datasets could happen). ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Resolving Conflicts
    ... Are you using SQL server database? ... Pessimistic concurrency control: A row is unavailable to users from the ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.vsnet.general)
  • RE: Resolving Conflicts
    ... Are you using SQL server database? ... Pessimistic concurrency control: A row is unavailable to users from the ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.vsnet.general)
  • Re: Effective use of DataAdapter.Update(DataSet)
    ... Concurrency isn't the only issue here and locked ... work for standard client server. ... Also, if you submit an update after every edit for instance, it's hard to ... > synchronize the DataSet with the database table, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Concurency in the functional world
    ... Still waiting to find out how. ... threads and exceptions seems doomed, even using STM. ... Well, depends what you're doing, of course, but for IO-bound concurrency ...
    (comp.lang.functional)