I have a datatable that contains a load of dates. I wanted to group them by date and give each line an account.
I managed to do this through dong:
IEnumerable query = from row in stats.AsEnumerable() group row by row.Field<string>("date") into grp select new { Date = grp.Key, Count = grp.Count(t => t["date"] != null) };
(where "statistics" is data)
From debugging, I can see that this returns values grouped as needed, but now I need to encode them and get each date and count.
My problem is that I do not know how to get the values!
I have a foreach loop
foreach (var rw in query) { string date = rw.Date;
I do not know what type of Ienumerable should be able to refer to the values in it!
So my question is, how can I get each date and count for each row by doing similar to the above?
Hope this makes sense!
source share