Wednesday, March 28, 2012

Lock SQL table using asp.net

Hi,all:
This problem almost drives me crazy, hope I can get some hints from you guyz!!!
Ok, here is the situation:
I wanna only one users 2 modify the data(update) from my page each time, and if at the same time, there are some other users connecting my database through .aspx page, they can only browse the data until the first users finish updating.
It seems I need to implement locking the database, but I am not sure how I am gonna do that using asp.net!!!
Thanx in advance!This sort of locking is not a great idea. What happens if the first editing user goes to lunch, or looses his connection, or just looses interest?

Better, create a system that will test to ensure that an impending update is in fact updating the same data as it originally got to do the editing on.|||Hi,douglas:
Thanx a lot for ur reply! But I still have some question about this,
would you mind telling me that if the sql server has this kind of functionality?
And if it has, how about the time-out for this function?
Thanx in advance!|||the problem is, you will not have an open connection to the database between page posts. Locking is not viable for an asp.net app.|||Hi, Douglas:
Thanx for the reply, I have one more question :)
Is it possible that I can excecute the "Lock Table..." sql statement in asp.net?
if it's possible, is there any limit time for that "lock"?
Thanx a lot!
Cheers|||Have a look at "isolation levels" and, in you specific case "serializable". But you really need to understand the ramifications otherwise you'll bring the database and/or your application to its knees.

No comments:

Post a Comment