OrderByDescending Issue on Group By query
Posted: Thu 25 Feb 2010 16:07
Hello, Im getting an error while doing an Order by on a group by query
The query will get the correct data, but as soon as I do the Order by I get the following error:
"Expression of type 'System.Decimal' cannot be used for constructor parameter of type 'System.Nullable`1[System.Decimal]'"
Thanks for the help.
Code: Select all
var reportData = (from pr in db.PageReports
where pr.CampaignID == 594
group pr by pr.DeviceID into g
select new
{
DeviceID = g.Key,
DeviceCount = g.Count(),
Device = (from d in db.Devices
where d.DeviceID == g.Key
select d)
});
var finalData = reportData.OrderByDescending(s => s.DeviceCount);
"Expression of type 'System.Decimal' cannot be used for constructor parameter of type 'System.Nullable`1[System.Decimal]'"
Thanks for the help.