The question has come up, how to lock a section of an application so two users
can not update the same form at once. Let?s say there is some type of work
flow in an HR application. There is a section to update an employee's Contact
Information.
There is one to many administrators that have access to update this
information. How can you prevent admin 2 from loading the form to update John
Doe's information, if admin 1 is already making changes?
If there isn't any locking feature put in place, admin 1 could make a change,
but if admin 2 loaded the form before admin 1 was finished, admin 2 could
overwrite the changes.
Any recommend ways to solve this problem would be greatly appreciated?
Kronin555 - 31 Aug 2005 23:03 GMT
Have a "version" field in the database that increments every time the
information is updated. Before updating it, ensure that the version passed
equals the version that is stored in the database. Pass the version as a hidden
field in the form.