Deadlock in Parallel.Foreach while using ExecuteNonQuery?
问题 I am facing deadlock error while using Parallel.Foreach. I have 1000 records in datatable and i'hv created 5 threads to process it. but when i'hv run this console application then after some records processed it will create a deadlock and no other records will process. Here is my code : Parallel.ForEach(dt1.AsEnumerable(), new ParallelOptions { MaxDegreeOfParallelism = 5 }, dr => { cmd1.CommandText = $"Update AuditMessage set Status=1" + $" where SXAEASCoreAuditMessageID ='{Convert.ToString