Re: Locking a record in Access from vb.net
- From: "Brendan Reynolds" <brenreyn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Mar 2006 23:18:47 -0000
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 Google
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
.
- Prev by Date: Re: Trying To Compare 2 Tables
- Next by Date: Re: Returned dates always one short
- Previous by thread: Re: Pls need help with Parameter Query to include All
- Next by thread: Re: Locking a record in Access from vb.net
- Index(es):
Relevant Pages
|
|