Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello to all

I have an application in LAN on a page that contains a GridView I want to disable or prevent
The edition of a line when it is already in edit mode by another user

Thank you.
Posted
Comments
bbirajdar 7-Dec-13 5:32am    
http://blog.sqlauthority.com/2007/04/27/sql-server-2005-locking-hints-and-examples/
Mahesh Bailwal 7-Dec-13 6:06am    
One way of doing this is to have database field which you can use as lock. Where whenever any user enter edit mode this field value should changed to 1 and when user is out of edit mode value should be changed to 0. Now when any user tries to add new line check this filed value and stop him accordingly.
Sergey Alexandrovich Kryukov 7-Dec-13 23:59pm    
The whole approach is bad...
—SA

1 solution

You should not prevent the edition, instead use Transactions in SQL.
It will automatically handle the transaction and queue the requests.

If somebody already edited the row and you want to edit it, so that's not problem as the Primary KeyID is the same.
The problem will occur if the row is deleted, for that you need to check if that row still exists in Table or not.
If exists, then only update.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900