Click here to Skip to main content
15,889,874 members
Please Sign up or sign in to vote.
4.00/5 (3 votes)
See more:
Error : Transaction (Process ID 52) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Please help.
Posted

 
Share this answer
 
 
Share this answer
 
v2
You can solve this case through code by using goto statement to retry again because dead lock happened in a very specific time while accessing database

C#
public int update_anything()
    {
    try_again:
      //your stuff here ...

      thisConnection.Open();

      try
      {

        myCommand.ExecuteNonQuery();

       }
    catch (SqlException exception)
    {
        MessageBox.Show(exception.Message);

        // to handle the sql server dead lock issue when two process
        // access  the same row
        if (exception.Number == 1205)
        {
            goto try_again; ;
        }
        else
        {
            throw;
        }
    }
    finally
    {
        thisConnection.Close();
    }
}
 
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