I am using two data tables. One has whole data (Dt_WholeData) from Excel and the other is distinct data (Dt_DistinctData) containing places only.
I need to concatenate emails from the same place. I am running this in for each row. Outer Loop is Dt_DistinctData and the inner loop is Dt_WholeData


@ajnaraya why you are not using group by in whole data.

I have to extract the data of corresponding places and need to send mail


How about using LINQ GroupBy and Dictionary as the following?

dict = Dt_WholeData.AsEnumerable.GroupBy(Function(r) r("Place").ToString).ToDictionary(Function(g) g.Key, Function(g) String.Join(";",g.Select(Function(r) r("Email").ToString)))


Thanks for the solution

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