Non match records in datatables

How to find Non match records in two datatables

@Bhagya_Shri

Please try this

Dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

Dt1.AsEnumerable().Where(Function(row) Not dt2.AsEnumerable().Where(function( r ) r(“Id”).ToString.Equals(row(“Id”).ToString)).Any).CopyToDataTable

Thanks

2 Likes

@Bhagya_Shri
dtMatched = (From rowMain In dtMain.AsEnumerable
Join rowCommon In dtFirst.AsEnumerable
On rowMain(0).toString.Trim Equals rowCommon(0).toString.Trim
Select rowCommon).CopyToDataTable

dtUnMatched = (From rowOne In dtFirst.AsEnumerable
Where Not dtMatched.Tolist.Any(Function (r) r(0).toString.Trim.Equals(rowOne(0).toString.trim))
Select rowOne).CopyToDataTable

Also can go through this thread

Hope this helps
Cheers

@Gvivek9889 Thanks for quick response

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