Compare 2 Datatables to get unmatched data based on 2 or 3 headers

Hi all,

Currently after using the below code, I’m unable to get the expected results that I wanted. did I made any mistakes?

DT2.AsEnumerable().Where(Function(row) Not DT1.AsEnumerable().Select(Function® r.Field(Of String)(“Invoice Number”)).Any(Function(x) x = row.Field(Of String)(“Invoice Number”)) Or Not DT1.AsEnumerable().Select(Function® r.Field(Of String)(“Invoice Date”)).Any(Function(x) x = row.Field(Of String)(“Invoice Date”))).CopyToDataTable()

Hi,

Check this link,

https://dotnetfiddle.net/HGxBu1

don’t rly understand the coding

Check the below code,

 Dim diffIDs = dt2.AsEnumerable().[Select](Function(r) r.Field(Of String)("ChildValue")).Except(dt1.AsEnumerable().[Select](Function(r) r.Field(Of String)("BaseValue")))
    Dim Table3 As DataTable = (From row In dt2.AsEnumerable() Join name In diffIDs On row.Field(Of String)("ChildValue") Equals name Select row).CopyToDataTable()

Use this custom activity to achieve your requirement.