OrderByDescending Issue on Group By query

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
fastjem
Posts: 3
Joined: Wed 03 Feb 2010 14:59

OrderByDescending Issue on Group By query

Post by 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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by 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.

fastjem
Posts: 3
Joined: Wed 03 Feb 2010 14:59

Post by fastjem » Thu 25 Feb 2010 19:35

Thanks that fixed it

Post Reply