This topic is locked

Record Locking

4/4/2009 5:40:40 AM
ASPRunnerPro General questions
T
telemark author

Can't seem to get the code given in Tips and Tricks working in v6.0 Build 766
I have added a asp code snippet on the edit page and named it EditOnLoad:

[codebox]set rstmp = Server.CreateObject("ADODB.Recordset")

rstmp.Open "select IsLocked, LockTime from " & strTableName & " where " & strWhereClause, dbConnection

if rs("IsLocked")=1 and DateDiff( "n", rs("LockTime"), now() )<5 then

Response.write "Record is locked. Come back later"

rstmp.close : set rstmp = nothing

Response.end

else

rstmp.close : set rstmp = nothing

dbConnection.Execute "update " & strTableName & " set IsLocked=1, LockTime=now() where " & strWhereClause

end if[/codebox]
I have also added in the before record updated event.

[codebox]dbConnection.Execute "update " & strTableName & " set IsLocked=0, LockTime=now() where " & where[/codebox]
I have checked the tables in the DB and they are being updated with the date time and islocked function. However I can still edit a record even when its open by someone else.
Thanks

J
Jane 4/7/2009

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.