Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an asp .net page which shows a gridview that embed a checkbox column. the asp .net page include a two buttons with text "succed" "fail".
The problem is that the gridview which lists all students that have passed an exam can be accessed by two managers who will for example check the check box of the same row and one click "succed" and the other "fail". so i ll have a concurrent access in the database. so is there any way to prevent that in the database.
Note that the web page includes also two other gridview one first one lists the students who succeded in the exam and the second one lists the student which fails.
Posted

If you can't use transactions for some reason, I would suggest adding a "last modified" timestamp field to each row of the table. When you generate the asp page to send to the user, add the last modified timestamp as a hidden field. If the user submits any form on the page, you can use this field to test against the current state of the database. If the timestamps match, then no concurrent access has occurred. Otherwise, report the problem.
 
Share this answer
 
v2
Thank you for your question.


You can solve this problem by reading the following likns:

Implementing Optimistic Concurrency with the SqlDataSource
http://www.asp.net/data-access/tutorials/implementing-optimistic-concurrency-with-the-sqldatasource-cs

For ADO.NET, please see:

Concurrency Control in ADO.NET
http://msdn.microsoft.com/en-us/library/22hhd212.aspx


Thanks,
Mamun
 
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