I am trying to figure out how to group each element on the same day it happened in the time range in Linq to SQL, but I cannot get it to work.
var graph = from o in DB.Context.Occurances
where o.Occurred > fromDate && o.Occurred <= toDate
group o by o.Occurred.Date into g
orderby g.Key ascending
select new
{
Date = g.Key,
Occurances = g.Count()
};
Every time I run this, I get an error
"The specified member of type 'Date' is not supported in LINQ to Entities. Only initializers, organization members, and entity navigation properties are supported."
Search I found this question here that solves this problem ... but when doing this using Entity Framework I get an exception
"The function is not recognized by SQL Server Compact. [Function name = TRUNCATETIME, data type (if known) =]"
Any ideas would be highly appreciated. Thank!