Last post Apr 09, 2008 12:11 PM by Chris A
Apr 03, 2008 12:17 PM|Chris A|LINK
I created a web application that sits on a web server. It retrieves data from a SQL db on a different server. After the data is retrieved the connection is closed. In the app, the user manipulates the data in the dataset hits update and the data is saved
back to the SQL db. This works fine unless there is more than one user. If a second user goes into the app. and retrieves data, it uses the same dataset the first user has opened clearing all of the data from the original user. How do I stop this?
Apr 03, 2008 12:49 PM|anthonypj|LINK
At the point of saving you need to compare the data originally uploaded with the data now on the server, and then take action occuringly.
You can do this a couple of ways
a) using a insert string that compares values
b) programmically loop throught feilds and comparing the values
Apr 03, 2008 04:55 PM|Chris A|LINK
After searching the web, I think the issue is being caused by the way I have created the dataset. I use Public Shared which allows me to use the dataset across different pages of the application. Which is great for a single user but with multiple users,
the dataset is shared between all users of the app. Any suggestions without causing major changes? I have The SQL connection done in a separate vb file.
Apr 07, 2008 03:44 AM|Thomas Sun – MSFT|LINK
In your case, to avoid this issue, you can use this DataSet without Shared. To use the DataSet across different pages, you can use session to store it.
If you prefer to use Shared, you can use private shared object to lock this DataSet to ensure that only one user can operate this DataSet at one time.
I hope this helps.
Apr 08, 2008 11:39 AM|Chris A|LINK
Since my web app is multi page, Private Shared doesn't work because the dataset and variables can't be read across different pages. I have an issue with the Session in that I encounter a similar problem when more than one user is accessing the application
at once. Session gets overwritten. Maybe it's in the way that I am using it. If you have any suggestions....
Apr 08, 2008 11:09 PM|Thomas Sun – MSFT|LINK
Thanks for your response.
If we use the session, every user has his own session value. So if we use it correctly, I think it won't be overwritten by another user.
For more information about using session, see
Apr 09, 2008 12:11 PM|Chris A|LINK
Thanks for the help. I think I have it straightened out. Part of the problem is that I still had a Shared variable floating around. The article was useful. It included another article that had good info also