Compare two columns from different datatable


I want to identify if there is any single unmatched value in two columns of different datatable.

Example :

Its a row wise check.
The first row value of column ID1 must be same to the first row value of column ID2. Similarly, the second row value of column ID1 must be same to the second row value of column ID2.

Thank you in advance for any help you can provide.

Geet M

Lets assume that dt1, dt2 have the same row count

Create a report DataTable with build datatable activity
Cols: C1, C2, Result - dtReport

Assign activty:
Left Side: dtResult
Right side:

(From i in Enumerable.Range(0, dt1.Rows.Count)
Let chk = dt1.Rows(i)(0).toString.Trim.Equals(dt2.Rows(i)(0).toString.Trim)
Let rs = IF(chk,"Correct","InCorrect")
Let ra = new Object(){dt1.Rows(i)(0),dt2.Rows(i)(0),chk}
Select r=dtReport.Rows.Add(ra)).CopyToDataTable

i case of you need a different output / report structure just share with us a detailed description on it. So we would adopt the approach


Its working…
Thank you so much!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.