Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show a msg to second user when the first user is saving the data

i want to code on save button so that if any user is saving the data then the second user get notification that someone processing.


please help....
Posted

1 solution

I do the next things.
In the table in the database I have a unique ID and a datetime field called lastmodified.
When retrieving the data from the database both fields are stored in the dataset or datatable object
When saving data both fields are added to the update query as sqlparameters. I first check if the lastmodified field is unchanged. If that is not changed the update is done and lastmodified is updated with the GetDate() value in the database. The number of rows updated is larger than 0 (ExecuteNonQuery result)
When the second user tries to update the data you can
- throw an error in your stored procedure which will be received in the dotnet program.
- conclude that the ExecuteNonQuery result was 0 and show the new value(s) from the database to the user.
 
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