Re: Locking a record in Access from vb.net
- From: "Brendan Reynolds" <brenreyn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Mar 2006 22:42:37 -0000
I'm afraid I'm the wrong person to ask. My experience is mostly with DAO and
more recently with ADO.NET. I never did much work with 'classic' ADO.
--
Brendan Reynolds
Access MVP
"Roy" <Roy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3280D09F-9A02-49CE-9C9A-A5307BD70665@xxxxxxxxxxxxxxxx
Thanks Brendan,
Would you explain what object of classic ADO and how it should be
implemented?
Roy
"Brendan Reynolds" wrote:
There's no built-in support (at least, not that I'm aware of) for
pessimistic locking in ADO.NET. You could 'roll your own' locking
mechanism.
Add a flag field to your table. Set it when a user selects that record
for
editing, clear it when they save changes. Before selecting a record for
editing, check the flag. The drawback to that approach is that it will
only
prevent 'locked' records from being edited by your app, or other apps
that
are aware of and respect your custom locking mechanism. There's no way to
enforce it if other apps are unaware of or fail to respect your locking
mechanism. You'll also need to be very careful about releasing locks if a
user cancels an edit or if an error occurs.
A possible alternative might be to use 'classic' ADO, with pessimistic
locking, via COM interop. But that's just an 'off the top of my head'
idea,
I haven't tested it.
BTW: There isn't any 'lockrecord' property in Access. Just thought I
should
mention that so some poor unfortunate doesn't read this thread in the
newsgroup archives and spend half a day looking for it! :-)
--
Brendan Reynolds
Access MVP
"Roy" <Roy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:75424E43-7C69-4D8D-9E06-24C7AA26BDCC@xxxxxxxxxxxxxxxx
Hi all,
I need to lock a record while a user edits that record, so other users
see
a
"Record is locked" message when try to access that specific record. I
know
there is a lockrecord property in Access, but I'm not sure how to lock
this
record from my vb.net form.
Any help would be highly appreciated.
Roy
.
- References:
- Re: Locking a record in Access from vb.net
- From: Brendan Reynolds
- Re: Locking a record in Access from vb.net
- Prev by Date: Re: Passign Multiple Criteria From a Form
- Next by Date: combine 2 access queries
- Previous by thread: Re: Locking a record in Access from vb.net
- Next by thread: Re: Multi table query
- Index(es):
Relevant Pages
|
|