Distinct().Count() returns incorrect value

Distinct().Count() returns incorrect value

Postby dilbert » Tue 28 Apr 2009 10:36

I'm currently using dotConnect for MySQL 5.20 Beta

I get incorrect value when trying to execute .Distinct().Count() expression.
Here is an example:

Code: Select all
            var query = DB.UserExamSubscriptions.Select(u => u.Id_user).Distinct();
            int count = query.Count();   
           
            int realCount = 0;
            foreach (int id in query)
            {
                realCount++;
            }

            // count == 1        (incorrect)
            // realCount == 488  (correct)


Count() method returns correct value if it is used without Distinct() method. But if they are used together, return value is always 1.

Thank you for your help in advance.
dilbert
 
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Postby AndreyR » Wed 29 Apr 2009 08:32

Thank you for the report, we have reproduced the problem and now we are fixing it.
I will let you know as soon as the fix is available.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby AndreyR » Thu 07 May 2009 12:48

The problem is fixed, look forward to the next build.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to LinqConnect (LINQ to SQL support)