I have two Data tables and few columns are similar in two datatables.I want to check a value from DT1 is present in DT2 if yes then it DT2 result data row should be copied to different Data table DT3 without using loop. Please anyone let me know how can we achieve this without using loop
It would be helpful if we could rely on some sample data
In general, we can do it (one of many options with LINQ). It is a match case
Assign Activity
dt3 =
(From d in dt2.AsEnumerable()
Let cv = d(ColNameOrIndex).ToString.Trim
Let chk = dt1.AsEnumerable.Any(function (d1) d1(ColNameOrIndex).ToString.Trim.Equals(cv))
Where chk
Select r = d).CopyToDataTable