int[] Inventory = new int[UniqueISBN.Length]; OleDbConnect.Open(); Parallel.For(0, UniqueISBN.Length, Index => { OleDbCommand_Update.CommandText = string.Join(null, "Select Count(*) From BookTable Where ISBN = '", UniqueISBN[Index], "'"); Inventory[Index] = (int)OleDbCommand_Update.ExecuteScalar(); OleDbCommand_Update.CommandText = string.Join(null, "Update BookTable Set Inventory = ", Inventory[Index], " Where ISBN = '", UniqueISBN[Index], "'"); OleDbCommand_Update.ExecuteNonQuery(); } ); Parallel.For(0, UniqueISBN.Length, Index => { EnumerableRowCollection<DataRow> Query = from Row in BookDataView.Table.AsEnumerable() where Row.Field<string>("ISBN") == UniqueISBN[Index] select Row; Parallel.ForEach(Query, Row => { Row["Inventory"] = Inventory[Index]; } ); } ); OleDbConnect.Close();
Managed Debugging Assistant 'RaceOnRCWCleanup' : 'An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss.'
.NET Framework 4.5.2
WPF
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)