Hi @Yomi_Oluwadara , From my point of view, there is no need for invoke code, as this would make it harder for someone that does not have a background in coding to understand. Find the alternative below:
FYI, this would be the output:
Step 1
Same as above, obtain the information in 2 separate DTs, and initialize a Dictionary of String, Int, where we will keep the duplicate keys and its count:
Step 2
Lets start with finding the missing values, using the linq you tried to use above, just tweaked it a bit to make it work, and not fail if there is no results (CopyToDatatable will throw a SE if there is no results)
dt_Source2.AsEnumerable.Where(Function(x) NOT dt_Source1.AsEnumerable.Select(Function(y) y("CAT_NO").ToString).Cast(Of String).ToArray.Contains(x("Cat_Acct_Num").ToString)).AsDataView.ToTable
Step 3
Finding duplicates if the activity above found any missing row. Looping the resulting rows in a for each, and storing the number of occurrences in a dictionary to be used later (Can be enhanced with a Linq, but for understanding purposes, for each is easier)
if there are no duplicates, the .AsDataview.ToTable will return an empty datatable, therefore there will be no loops on the for each, and the dictionary will return empty, while if you leave it as above, with the CopyToDatatable, you need to catch the error.
Hope this helps! Attaching sequence for your reference.