tags:

views:

58

answers:

1

Environment: SQL, LINQ, C#

I have 2 WinForms running on different computers.
They all hit the same database, and it's extremely critical that these forms don't affect the state of the database. I have a couple of questions.

WinForm1, the linq queries in this form are all try/catched, if there is a concurrency conflict, I believe this will never fail (correct me if I'm wrong)

WinForm2, the linq queries in this form can conflict with the ones in WinForm1, but each query is also try/catched.

Question: If there are any concurrency conflicts between these forms, is it possible that the database will be locked out (no other queries can access the database)? If not, is there any situation where a concurrency conflict can make the database unqueriable?

+1  A: 

LinqToSql uses Optimistic Concurrency, which does not lock the database.

Deadlocks are the actual threat, not concurrency conflicts.

The best approach to preventing deadlocks is to keep updates small and fast.

David B
So the queries will fail where they are being sent, but they won't actually lock the database?Also, when there is a deadlock situation, it only stops the two queries that are in conflict with each other, and no other queries?Sorry for being so anal, but it is important that I understand these issues as fully as possible. Thanks.
Soo
Yes (you can't have a conflicted select, update will fail if there's a conflict) and Yes (one of the deadlocked queries will be killed, the other one will then be allowed to complete).
David B
Ok, thanks. That works for me
Soo