What you're doing is basically a bad idea. What happens if the user locks
the record then goes away for lunch, shuts their browser down, has a power
cut etc? You should never hold locks across page processes, you'll have to
kludge it by adding a "editing by" type field or some other solution.
You're main problem is going to be issues with how long you want these
records to remain locked for.
Aidy,
Thanks for the thought, and yes that can be a hazard. So can having two
people trying to edit the same record at the same time.
I would expect that if someone locks a record and goes away for lunch, the
session terminates in 20 minutes, any connection to the SQL Server database
goes away, and the lock drops out. The problem here is that standard
database locking may not work at all since the connection actually drops the
moment the page is written, since this is a stateless system.
And btw, you solution of setting up a reservation field to kludge it has
exactly the same problem as locking the record. Someone goes away with the
reservation field set, and no one else is allowed to get to it.
> What you're doing is basically a bad idea. What happens if the user locks
> the record then goes away for lunch, shuts their browser down, has a power
[quoted text clipped - 20 lines]
> >
> > Thanks!
Aidy - 03 Oct 2007 09:38 GMT
> And btw, you solution of setting up a reservation field to kludge it has
> exactly the same problem as locking the record. Someone goes away with
> the
> reservation field set, and no one else is allowed to get to it.
Yes but that is a logical problem. Such systems could tell you "This record
is locked by so-and-so and has been for 25 minutes. Do you want to override
their lock?". Whereas if you have a SQL lock people are physically
prevented from accessing the data at all until a sysadmin comes along and
starts killing processes.