How to compare multiple rows in two datatables using linq

how to compare multiple rows in two datatables using linq

@Vijay_RPA
can you share some sample data and a description of expected output with us. So we can adress it individually to your case

i have multiple columns A,B ,C in two data tables I just want match the data in each row of those columns in two data tables .
currently I am using (From x In batchDt.AsEnumerable() where (From a In batchDt.AsEnumerable() Join b In masterDT.AsEnumerable() On a(“CompanyOutlet”).ToString() Equals b(“CompanyOutlet”).ToString() select a).Contains(x) select x).CopyToDataTable() .But it can only match one column .But how can we do it for multiple columns

@Vijay_RPA
as mentioned in the title you are interessted on a linq approach i will adress on this. However also be aware of the join datatable activity

in gebneral it could look like this

(Form d1 In dtData1.AsEnumerable
Join d2 In dtData2.AsEnumerable
On d1(YourColumnNameOrIndex).ToString() Equals d2(“YourColumnNameOrIndex”).ToString() And d1(YourColumnNameOrIndex2).ToString() Equals d2(“YourColumnNameOrIndex2”).ToString()
Select d1).CopyToDataTable

As requested above. Share some sample data and description of expected output and we can help you on more individually.

From x In batchDt.AsEnumerable() where (From a In batchDt.AsEnumerable() Join b In masterDT.AsEnumerable() On a(“CompanyOutlet”).ToString() Equals b(“CompanyOutlet”).ToString() select a).Contains(x) select x).CopyToDataTable()

Please elaborate on the targeted scenario. thanks

1 Like

Sure Thank You so much… Ping You personally :slight_smile: