|
|
To implement record locking (when a record is locked while
editing):
1. Add two additional fields IsLocked (Yes/No field) and
LockTime (Datetime field)
to the database table.
2. Add the following code to the Edit page: Before process event. In the
example below, timeout is set to 20 minutes.
Note: Change the values listed in
red to match your specific needs.
set rstmp = dal.TableName.Query(where,"")
if rstmp("IsLocked")=1 and DateDiff( "n", rstmp("LockTime"), now() )<20 then
Response.write "Record is locked. Come back later"
rstmp.close : set rstmp = nothing
Response.end
else
rstmp.close : set rstmp = nothing
conn.Execute "update strTableName set IsLocked=1, LockTime=now() where " & where
end if
|
To unlock a record use the following code in Edit
page: Before record updated event:
conn.Execute "update " & strTableName & " set IsLocked=0, LockTime=now() where " & where
|
|