Click here to Skip to main content
15,888,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi there, I have an application to show something from a database. Only one can access this database at a time. if one user is accessing or viewing the page, the other user will not be able to access the same. How to achieve such task ?
Posted

1 solution

You can log the user activity details in new table. for example when user start this activity you can go and check whether any other user active or not by using table data. if there is no active user, you can insert new record with details like, user id, activity start time etc..
if user already active you can show message to new users that already another user active on this activity.
When user finish the activity you can go and updated the record by using another column. There will be a issue when the user disconnected while activity in progress. You may need to have activity timeout to handle that.
 
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