Code taking long time to execute

Hi @Ritika_Singh ,

Could you maybe try by creating the prepared data for the comparison ? As it seems from the code you are trying to compare only one column from the other datatable.

We could get the Data prepared for that and stored it an array or a list, then perform the comparison on the list prepared. This way we should be able to reduce some time in Always iterating through the datatable and grabbing the values again.

claimNumbers = processedDataDT.AsEnumerable().Select(Function(r) r("Claim Number").ToString.Trim).ToArray

Here, claimNumbers is a variable of type Array of String

Next, we can use this array in the same way in the Linq that you have mentioned.

completeDataIvosDT.AsEnumerable().Where(Function(row) Not claimNumbers.Any(Function(x) x.Equals(row("Claim Number").ToString.Trim))).CopyToDataTable()

Let us know if this reduces the time for execution.

Also Check the below post for handling errors on Direct conversion to Datatable.