How to match two data table depends on one columns and delete the row from second data table?

How can I implement this? Any activity would do but I prefer LINQ.

I have two datatables, DT1 and DT2.
DT1

Account name
123 ABC
345 CDA
567 KJB
321 KIC
789 DTC

DT2.

Account name
123 lmn
325 kjf
658 uti
321 lcd
789 ADZ

need output like this
if in DT1 and DT2 has same account number then need to remove same account number raw from the DT2

DT1

Account name
123 ABC
345 CDA
567 KJB
321 KIC
789 DTC

DT2
325 kjf
658 uti

Thanks in advanced.
Andy

@Andy5

Use a for each row in datatable on first dt and then use filter datatble on dt2 inside the loop

or

dt2.AsEnumerable.Where(function(x) Not dt1.AsEnumerable.Where(function(y) y("Account").ToString.Equals(x("Account").ToString)).Count>0).CopyToDatatable

cheers

1 Like

Thanks yes its working

1 Like

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