Find unmatched data between two data table with different column names

Hi Team,

I have two data tables with different column names but one particular column in both have similar data , I want to find all those rows in DT1 which are not there in DT2 based on the column values ,
image|160x190
The outcome should be 3

Hi @Yoichi , any Linq query which we can use.

Thanks in advance

Hi @ritika.singh

dt1

image

dt2

image

dt2Arr

image

dt2.AsEnumerable.Select(Function(r) r("Column1")).ToArray

dt

image

(
    From row in dt1.AsEnumerable
    Where Not dt2arr.Contains(row("Column1"))
    Select row
).CopyToDataTable

Output (dt)

image

Please refer the attached xaml

FindUnmatchedDataBWTwoDT.xaml (9.9 KB)

Hello @ritika.singh ,

You can use the below Linq to get the unmatched records based on particular (common) columns in 2 DTs.

outDt = inputDT1.AsEnumerable().Where(function(row) Not inputDT2.AsEnumerable().Select(function(r) r(“ColumnName”).ToString).Any(function(x) x = row(“ColumnName”).ToString)).CopyToDataTable()

Thanks,
Rohith

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