LINQ, "Argument types do not match" error, what does it mean, how do I address it?

Posted by Biff MaGriff on Stack Overflow See other posts from Stack Overflow or by Biff MaGriff
Published on 2010-06-09T16:20:49Z Indexed on 2010/06/09 16:52 UTC
Read the original article Hit count: 1085

Filed under:
|
|

Hello,

I'm new to linq and I'm trying to databind to an anonymous type.

I'm using SubSonic 3.0 as my DAL.

I'm doing a select from 2 tables like so

        var myDeal = (from u in db.Users
                  select new
                      {
                          UserID = u.UserID,
                          UserRoleID = (from ur in u.UserRoles where u.UserRoleID == ur.UserRoleID select ur).FirstOrDefault().UserRoleID
                      });
    foreach (var v in myDeal) //dies first time here
    {
    }

Then when I databind or try to iterate through the collection I get the "Argument types do not match" error during run time.

I'm not sure what is going on here.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ