PDA

Click to See Complete Forum and Search --> : how to lock record in COM+


moosepapi
Oct 29th, 2001, 10:10 PM
Hi everybody,
We just started project based on COM+ technology.
We don't have clear understanding how to obtain lock
of the record when several users try to manipulate with
the same record in the sql server database
(for example several users are trying to get customer
object and update the same field in the database table)
Do we need programmatically lock record for the first
user that get ownership of the record for certain time
or is there another way to work with the same record
in the COM+ environment.Any ideas will be
appreciated.
Thanks in advance.

Bill Crawley
Nov 1st, 2001, 11:23 AM
Hi,

This isn't a COM problem, but one of general database locking. Before you query the database, you need to decide what action is going to be performed. You should only lock the record at the point you are about to make the update. Quite often your procedure will lock the record, test the timestamp on the record if it is later than the one you are trying to write, then it means that someone else has updated since you last had the record. You would then reject the update and inform the user also releasing all locks. If you have a large N-Tier App that you are looking to use, then you should consider MTS since this can help in this kind of situation.

Glen711
Nov 1st, 2001, 12:21 PM
Thank you Bill,
Your idea is really good and we actually kept in mind it.But we work in COM+ environment(actually it's new version of MTS that shiped with Windows2000).
Could you give any idea how it could be implemented in this particular environment.
Thanks