Board index » delphi » Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0

Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0

Did anybody get the record locking to work in ADO with access 97/2000 using
JET 4.0 ? I have an application residing on a server with the .mdb file and
if we both edit a field of a particular row it will let both of us do it..
I've been wasting hours on this and tryed many settings and nothing seems to
work.. Help.

David

 

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


I think that ADOExpress does not support Pessimistic locking mechanism as it
never Edit the recordset.

It is very difficult to make a TDataset descendant that work on Ms ADO or
DAO as they do not allow to lock a record and then move, as TDataset need.

Example :

If you edit a record in a grid, recordset should be in edit mode.
Then you resize the grid : the grid so the TDataset ask for data, so you are
obliged to move through your recordset.
At this time you recordset is no longer in Edit mode...

Perhaps Mark and others Borland developpers have a solution.

Alex

David Chaumont <da...@chaumontsystems.com> a crit dans le message :
7vafl3$cg...@forums.borland.com...

Quote
> Did anybody get the record locking to work in ADO with access 97/2000
using
> JET 4.0 ? I have an application residing on a server with the .mdb file
and
> if we both edit a field of a particular row it will let both of us do it..
> I've been wasting hours on this and tryed many settings and nothing seems
to
> work.. Help.

> David

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Ok thanks.. Guess i'll wait for more feedback. Anybody else have any info on
this subject for me?

David

Quote
Alexandre DANVY <alex-...@ebp.fr> wrote in message

news:7vc1l2$ot017@forums.borland.com...
Quote
> I think that ADOExpress does not support Pessimistic locking mechanism as
it
> never Edit the recordset.

> It is very difficult to make a TDataset descendant that work on Ms ADO or
> DAO as they do not allow to lock a record and then move, as TDataset need.

> Example :

> If you edit a record in a grid, recordset should be in edit mode.
> Then you resize the grid : the grid so the TDataset ask for data, so you
are
> obliged to move through your recordset.
> At this time you recordset is no longer in Edit mode...

> Perhaps Mark and others Borland developpers have a solution.

> Alex

> David Chaumont <da...@chaumontsystems.com> a crit dans le message :
> 7vafl3$cg...@forums.borland.com...
> > Did anybody get the record locking to work in ADO with access 97/2000
> using
> > JET 4.0 ? I have an application residing on a server with the .mdb file
> and
> > if we both edit a field of a particular row it will let both of us do
it..
> > I've been wasting hours on this and tryed many settings and nothing
seems
> to
> > work.. Help.

> > David

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Thi may be not godd configured Access.
I think you should try such locking using only Access mechanizms
and if it will do work properly then put the question again on this
usnet group.

Tomek Cwajda

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Quote
David Chaumont <da...@chaumontsystems.com> wrote in message

news:7vccjn$sn018@forums.borland.com...

Quote
> Ok thanks.. Guess i'll wait for more feedback. Anybody else have any info on
> this subject for me?

The ADOExpress components don't directly support pessimistic record locking
because ADO itself does not have any way to arbitrarily lock a given record and
still support navigating to other records.

There is something that you can try, but keep in mind it won't work if you do
something that forces a reread of data from the underlying recordset.  In the
AfterEdit event of your dataset add the following code:

  ADODataSet1.UpdateCursorPos;
  ADODataSet1.Recordset.Fields[0].Value := ADODataSet1.Recordset.Fields[0].Value;

You must have CursorLocation set to clUseServer.

One other option might be to use a cloned cursor to manage the locking.

Good luck,

Mark

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Mark,

I really agree with your explaination : This is a ADO/DAO behaviour :
It is not possible to lock a spcific record, only the current one...

After spending our to find a solution to correct the same problem with DAO,
I think that there is not solution.
If I remember in DAO Recordset.Clone can have different position, order but
not state. Perhaps it is possible in ADO.

Today I use a table to store locks manually (in fact a TDataset descendant
that automatically do the job).
This is the best solution :
- You can lock a single record (and not a page)
- You can lock several records
- You can retrieve the lock owner information (name, machine, etc...)

Alex

Mark Edington (Borland) <meding...@nolunchmeat.com> a crit dans le message
: 7vqavh$j...@forums.borland.com...

Quote
> David Chaumont <da...@chaumontsystems.com> wrote in message
> news:7vccjn$sn018@forums.borland.com...

> > Ok thanks.. Guess i'll wait for more feedback. Anybody else have any
info on
> > this subject for me?

> The ADOExpress components don't directly support pessimistic record
locking
> because ADO itself does not have any way to arbitrarily lock a given
record and
> still support navigating to other records.

> There is something that you can try, but keep in mind it won't work if you
do
> something that forces a reread of data from the underlying recordset.  In
the
> AfterEdit event of your dataset add the following code:

>   ADODataSet1.UpdateCursorPos;
>   ADODataSet1.Recordset.Fields[0].Value :=

ADODataSet1.Recordset.Fields[0].Value;

- Show quoted text -

Quote

> You must have CursorLocation set to clUseServer.

> One other option might be to use a cloned cursor to manage the locking.

> Good luck,

> Mark

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Alexandre, could you give me more specific details on how your doing this?
i'm interested.

David

Quote
Alexandre DANVY <alex-...@ebp.fr> wrote in message

news:7vrpuh$ar5@forums.borland.com...
Quote
> Mark,

> I really agree with your explaination : This is a ADO/DAO behaviour :
> It is not possible to lock a spcific record, only the current one...

> After spending our to find a solution to correct the same problem with
DAO,
> I think that there is not solution.
> If I remember in DAO Recordset.Clone can have different position, order
but
> not state. Perhaps it is possible in ADO.

> Today I use a table to store locks manually (in fact a TDataset descendant
> that automatically do the job).
> This is the best solution :
> - You can lock a single record (and not a page)
> - You can lock several records
> - You can retrieve the lock owner information (name, machine, etc...)

> Alex

> Mark Edington (Borland) <meding...@nolunchmeat.com> a crit dans le
message
> : 7vqavh$j...@forums.borland.com...
> > David Chaumont <da...@chaumontsystems.com> wrote in message
> > news:7vccjn$sn018@forums.borland.com...

> > > Ok thanks.. Guess i'll wait for more feedback. Anybody else have any
> info on
> > > this subject for me?

> > The ADOExpress components don't directly support pessimistic record
> locking
> > because ADO itself does not have any way to arbitrarily lock a given
> record and
> > still support navigating to other records.

> > There is something that you can try, but keep in mind it won't work if
you
> do
> > something that forces a reread of data from the underlying recordset.
In
> the
> > AfterEdit event of your dataset add the following code:

> >   ADODataSet1.UpdateCursorPos;
> >   ADODataSet1.Recordset.Fields[0].Value :=
> ADODataSet1.Recordset.Fields[0].Value;

> > You must have CursorLocation set to clUseServer.

> > One other option might be to use a cloned cursor to manage the locking.

> > Good luck,

> > Mark

Re:Record locking with ADO - Delphi 5 and Access 97/2000 - Jet 4.0


Quote
>Today I use a table to store locks manually (in fact a TDataset descendant
>that automatically do the job).
>This is the best solution :
>- You can lock a single record (and not a page)
>- You can lock several records
>- You can retrieve the lock owner information (name, machine, etc...)

It is very interesting how You implemented it - can you explain or
share some examples of code.

Tomek

Other Threads