I have two datatables A and B with approx. 50000 rows in each. I am comparing some of the columns (not complete raw) of table B to the datatable A, using two foreach loops. The comparision takes 2~3min to complete. Is there a way to improve performance?
foreach (DataRow entry in B.Rows)
{
// Compare results
foreach (DataRow dr in A.Rows)
{
if (entry[1].ToString().ToUpper()== dr[2].ToString().ToUpper() && entry[2].ToString().ToUpper()== dr[3].ToString().ToUpper())
{
// do stuff....
entry[1]== dr[2];
entry[2]== dr[3];
break;
}
}
}