C#, Manage concurrency in database access

Posted by Goul on Stack Overflow See other posts from Stack Overflow or by Goul
Published on 2011-01-13T14:43:51Z Indexed on 2011/01/13 14:53 UTC
Read the original article Hit count: 118

Filed under:
|
|
|

Hi there,

I have written a while ago an application used by multiple users to handle trades creation. I haven't done development for some time now and can't remember how I managed the concurrency between the users and so would have liked your advices in term of design.

The application was as follow:
- One heavy client per user
- A single database
- Access to the database for each user to insert/update/delete trades
- A grid in the application reflecting the trades table. That grid being updated each time someone changes a deal.

My questions:
1- Do you confirm I shouldn't care about the connection to the database for each application. Considering that there is a singleton in each, I would expect on connexion per client with no issue.
2- How preventing the concurrency of the accesses? I guess I should lock when modifying the data, however don't remember how to.
3- How to have the grid automatically updated whenever the database is (by another user for example)?

Thank you in advance for your help!

© Stack Overflow or respective owner

Related posts about c#

Related posts about database