I have two DTs and I want to see if each line matches the other line. How can I do this without Excel? Currently, I’m writing each DT to a tab in an Excel document and then using =IF(CD!1:1=PD!1:1,“True”,“False”) and then I read that column with the function and if I have a value of “false” then I know there is a mismatch in data between the two tables.
hi @rgardner5564,
use this,
MatchedDT (DataTable) = Dt1.AsEnumerable().Where(Function(row) Dt2.AsEnumerable().
Select(Function(r) (r.Field(Of String)(0)).Trim).Any(Function(x) x = (row.Field(Of String)(0)).Trim)).
CopyToDataTable()
this will give you matched rows from both your dts and copy it to a new datatable
1 Like