C# and MS SQL DeadLock
-
Hi All, I use a MS SQL Database with Windows Application c# and I need to manage the deadlock of my table of multiple users insert into this table in the same time, I need to check if the table was deadlock at each save before insert into it, and i don't need to depend on the Try catch block (dead lock exception). Please let me know how to Solve it. Thank you
-
Hi All, I use a MS SQL Database with Windows Application c# and I need to manage the deadlock of my table of multiple users insert into this table in the same time, I need to check if the table was deadlock at each save before insert into it, and i don't need to depend on the Try catch block (dead lock exception). Please let me know how to Solve it. Thank you
You can't check for a deadlock and then perform an action as these are two discrete operations. In other words, in the period between you somehow performing the check and then performing the save, another operation may have deadlocked the table. You can pretty much only react to the deadlock.
This space for rent
-
Hi All, I use a MS SQL Database with Windows Application c# and I need to manage the deadlock of my table of multiple users insert into this table in the same time, I need to check if the table was deadlock at each save before insert into it, and i don't need to depend on the Try catch block (dead lock exception). Please let me know how to Solve it. Thank you
-
Hi All, I use a MS SQL Database with Windows Application c# and I need to manage the deadlock of my table of multiple users insert into this table in the same time, I need to check if the table was deadlock at each save before insert into it, and i don't need to depend on the Try catch block (dead lock exception). Please let me know how to Solve it. Thank you
Hello, are you sure it's a deadlock or it is a generic timeout? A table can't deadlock just because many users try to insert. Deadlock means someone is blocking record A then try to lock record B while other process locked B then try to lock A. If that happens just have both the process lock the resources in the same order (first A then B) this will avoid the deadlock, by definition, and can be done saving all records sorted by primary key, for example, within a trasaction. Best Regards Andrea