Hi
I am working on a .NET 2.0 windows application.
I need to compare two datatable with same schema. The 2 DataTables will have around 1 lakh records.
I want to compare each row in Table1 with Table2 and also all the columns in each row.
I want to do the following
1. Get Row1 from Table1. Check if the same row is present in Table2
2. If Row1 is present ,Check every column in Row1 with corresponding columns of that Row in Table2
3. Bind Table1 to a Grid. Highlight the changed cells in Red.
I used the following code to loop through each row and compare each and every cell. But this takes more time.
For Each adoRow1 In Table1.Rows
adoRow2 = Table2.Select("id=adoRow1(0)");
'Compare each cells in adoRow1 and adoRow2
If adoRow1.Item("SequenceNo").ToString <> adoRow2.Item("SequenceNo").ToString) Then
intDiff += 1
adoRow1.Item("Changed") = "1"
End if
.
.
.
.
' do this for all the cells in adoRow1
Next
On executing the above for loop there is serious performance issue.
How to make this comparision faster?
Is it possible to use Threading and use separate Thread for this comparision and make it faster?
Thanks
Ashok
I am working on a .NET 2.0 windows application.
I need to compare two datatable with same schema. The 2 DataTables will have around 1 lakh records.
I want to compare each row in Table1 with Table2 and also all the columns in each row.
I want to do the following
1. Get Row1 from Table1. Check if the same row is present in Table2
2. If Row1 is present ,Check every column in Row1 with corresponding columns of that Row in Table2
3. Bind Table1 to a Grid. Highlight the changed cells in Red.
I used the following code to loop through each row and compare each and every cell. But this takes more time.
For Each adoRow1 In Table1.Rows
adoRow2 = Table2.Select("id=adoRow1(0)");
'Compare each cells in adoRow1 and adoRow2
If adoRow1.Item("SequenceNo").ToString <> adoRow2.Item("SequenceNo").ToString) Then
intDiff += 1
adoRow1.Item("Changed") = "1"
End if
.
.
.
.
' do this for all the cells in adoRow1
Next
On executing the above for loop there is serious performance issue.
How to make this comparision faster?
Is it possible to use Threading and use separate Thread for this comparision and make it faster?
Thanks
Ashok