Firstly, Apologies for the duplicate topic but I tried all the solutions mentioned.
So, I have got 2 datatables using which I am performing operation like finding matched & Unmatched records using LINQ, I have always used the same LINQ and worked fine until now.
To get matched
dt1.AsEnumerable().Where(function(row) dt2.AsEnumerable().Select(function(r) r.Field(Of String)(“Contract no.”.ToString.Trim)).Any(function(x) x = row.Field(Of String)(“Contract no.”.ToString.Trim))).CopyToDataTable
To get unmatched
dt1.AsEnumerable().Where(function(row) NOT dt2.AsEnumerable().Select(function(r) r.Field(Of String)(“Contract no.”.ToString.Trim)).Any(function(x) x = row.Field(Of String)(“Contract no.”.ToString.Trim))).CopyToDataTable
Sample data attached.
When I got the error I changed .to string to .To double(Not recommended though) still I got error saying cast is not valid.
if I remove the field of part, it works for matched but unmatched does not work.
Any suggestion will be very helpful.Test.xlsx (10.5 KB)