Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Database Update in Multiuser Environement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-10-01 : 08:22:08
Kiran Kumar Dasari writes "Hi

we have been developing web application which uses sql server as back end and manages all the database about various members of an orgranisation. It is somewhat similar to online banking application. In our application users of the system can login from anywhere and update the information. But our application does not handle multi user environment like for example if the two users update same member info it will get updated for both. All the save logic has been coded in stored procedures is there a way we can handle concurrency control.
Please help

thanks
kiran"

X002548
Not Just a Number

15586 Posts

Posted - 2003-10-01 : 10:35:51
Unlike a race...last one in wins...

Unless you determine that a row has been updated since the time a record is selected (using something like an update datetime column) you will never know...

Is that what you're trying to protect against?



Brett

8-)

SELECT @@POST FROM Brain ORDER BY NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page

SqlStar
Posting Yak Master

121 Posts

Posted - 2003-10-01 : 10:52:38
Hi,

quote:
if the two users update same member info it will get updated for both.


How its possible?! SQL-Server have multiple lock facilities.We can restrict this.If u send me some sample stored procedure, which u written,I will give some suggestions.



":-) IT Knowledge is power :-)"
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2003-10-02 : 03:25:58
quote:
SQL-Server have multiple lock facilities.We can restrict this.

EGAD! Be VERY careful about locking things from a web application. I'd suggest you go with something like Brett suggests. This would be a great place to put in a timestamp column (instead of datetime). Then be sure to always pass that column back to the stored procedure that does the update. Before the sproc issues the update, it can query the table to see if the current value of the timestamp is the same as the value passed in from the web page. If so, do the update, if not, reject the update and tell the user to refresh and try again.

--------------------------------------------------------
Visit the SQLTeam Weblogs at [url]http://weblogs.sqlteam.com[/url]
Go to Top of Page
   

- Advertisement -