Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: record locking


Message #1 by "Pieter" <pieter.schockaert@c...> on Fri, 9 Nov 2001 11:10:50
Hello,



I have a web application where I want to lock a certain record when I 

enter a specific window and unlock it after that record has been updated 

or maybe after a specific time (to prevent that the record stays locked 

after a crash, ...). Is there a way to do this with an ASP script, i.e. 

call a lock script when entering that screen and an unlock script after 

the update?



Please help, so I can prevent that 2 or more users are working at the same 

time with that record.



thanks,

Pieter
Message #2 by "Ken Schaefer" <ken@a...> on Sat, 10 Nov 2001 00:36:27 +1100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Pieter" <pieter.schockaert@c...>

Subject: [access_asp] record locking





: Hello,

:

: I have a web application where I want to lock a certain record when I

: enter a specific window and unlock it after that record has been updated

: or maybe after a specific time (to prevent that the record stays locked

: after a crash, ...). Is there a way to do this with an ASP script, i.e.

: call a lock script when entering that screen and an unlock script after

: the update?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



There's no way you can do this using ASP, due to the disconnected nature of

the web.

I suggest you add an extra field to the record. When the record is extracted

for "editing" you set the flag to 1 (indicating that it is being edited).

You may also wish to add another field recording the time that this flag is

set. When the field is posted back to the server, set the field back to 0



Cheers

Ken





Message #3 by "Samuel Fullman" <sam@c...> on Sun, 18 Nov 2001 02:05:00
There is a way to do what you want.



I suggest you set an application variable (it could either be a variable 

or an array) with the PRIMARY key of the record being edited as the page 

is pulled.



when the form is submitted by that page, have the receiving page release 

or erase the application variable.



Additionally, have the page itself qualify it's own recordset so that any 

individual record being worked on by all people cumulatively is excluded 

from the SQL query.  It would look like this:



"select ID, name, address, phoneNumber from myTable where ID <> 123 and ID 

<> 124 and ID <> 125 sort by ID ASC"



In this case 123, 124, and 125 are "Out" and being modified by other 

people , and so the page excludes them.



There are time-out issues involved and some way to release the variable in 

case any user doesn't finish what they are doing or their computer 

crashes.  But you CAN do it using application arrays, it it is that 

critical.



Sam Fullman

  Return to Index