OrderByDescending Issue on Group By query

OrderByDescending Issue on Group By query

Postby fastjem » Thu 25 Feb 2010 16:07

Hello, Im getting an error while doing an Order by on a group by query

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);


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.
fastjem
 
Posts: 3
Joined: Wed 03 Feb 2010 14:59

Postby AndreyR » Thu 25 Feb 2010 16:38

I have just tried the similar code using the latest 5.70.97 build and succeeded.
I recommend you to upgrade to the latest build.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby fastjem » Thu 25 Feb 2010 19:35

Thanks that fixed it
fastjem
 
Posts: 3
Joined: Wed 03 Feb 2010 14:59


Return to dotConnect for MySQL