I have one datatable with approx 82000 records & another Datatable with approx. 27015 records. I want to remove the records of second DT from the first and get the balanced records.
To achieve the above I tried the below query
“DT1.AsEnumerable().Where(Function(row) Not DT2.AsEnumerable().Select(Function(r) r.Field(Of String)(“Claim Number”)).Any(Function(x) x = row.Field(Of String)(“Claim Number”))).CopyToDataTable()”
For less number of records the query works but for higher number of records it is getting stuck
Tried with Inner Join too but getting the below error -
‘Job stopped with an unexpected exit code 0xE0434352’
From d in DT1.AsEnumerable
Where Not DT2.AsEnumerable().Select(Function(r) r.Field(Of String)(“Claim Number”)).Any(Function(x) x = d.Field(Of String)(“Claim Number”))
Select d).CopyToDataTable()
we do see that there is a repeated calculation, collecting of the Claim numbers. When LINQs are slow the first thing we can do is to reduce the operations.