Filter DataTable1 by excepting rows from DataTable2 by comparing specific column

I have two DataTables which might contain the same rows with some different data in some columns.
I need to except from dt1 all the rows from dt2 by comparing the first 8 columns only.

give a try at

dtResult =

(From d in dt1.AsEnumerable
Let raf = d.ItemArray.Take(8)
Let chk = dt2.AsEnumerable.Any(Function (d2) d2.ItemArray.Take(8).SequenceEqual(raf))
Where not chk
Select r =d).CopyToDataTable


  • both dts are defining the same datacolumns and its DataTypes
  • no trims needed

Empty Filterresult handling:

It returns the expected results.
Thank you.

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