DataTable foreach error

Test.xaml (10.4 KB)

can anyone tell me know why given code is not working…
getting error: For each : An ActivityContext can only be accessed within the scope of the function it was passed into.
Object name: ‘System.Activities.CodeActivityContext’.

what I am trying to do is match dt2 with dt1, where condition matches update dt2’s row with value of dt1’s row
please note both dt have around 7k-8k rows

or if you have an alternate solution please let me know…



I think I remember getting this error before and it was because you need to use .ToArray on the end. So give that a try.
dt2.Select.Where(function(x) x(0).ToString = row(0).ToString).ToArray


Thank you @ClaytonM it worked for me…
if possible can you tell me know why I was getting this error…

I am not actually sure of the reasoning. Given the context clues, I assume the ForEach requires a different type instead of an ienumerable(of datarow), so an array is a type that works.


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