I compare two DataTables usig the the syntax provided by @ppr which works exactly as expected
(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
The thing is that some times the data from the fourth column of one of the DataTables (which contains a date) is interpreted as a DateTime like “15/12/2023 00:00:00”
So I need to keep just the first 10 characters for this column.
I see 2 approaches :
Use substring method in order to keep the 10 first characters
Parse the date to string using the format (“dd/MM/yyyy”)
(From d In Datatable1.AsEnumerable
Let raf = d.ItemArray.Take(3).Concat({d.Field(Of String)(3).Substring(0, 10)}).Concat(d.ItemArray.Skip(4))
Let chk = Datatable2.AsEnumerable.Any(Function(d2) d2.ItemArray.Take(8).SequenceEqual(raf))
Where Not chk
Select r = d).CopyToDataTable
Thank you @mkankatala
The detail is that the dt have more than 8 columns, but the comparison is performed on the 8 first columns.
So the exclusion is not performed in this case.