开发者

linq where clause problem on multiple join tables

开发者 https://www.devze.com 2023-01-23 11:02 出处:网络
var studentDetails = from aspUser in db.aspnet_Users join aspMembership in db.aspnet_Memberships on aspUser.UserId equals aspMembership.UserId
var studentDetails = from aspUser in db.aspnet_Users
join aspMembership in db.aspnet_Memberships on
    aspUser.UserId equals aspMembership.UserId
join expUser in db.explore_users on
           aspUser.UserId equals expUser.aspnetUserId
               where expUser.Id.Equals(studID)
               select new { expUser.DOB,
                            aspMembership.Email,
                            aspUser.UserName,
                            aspUser.LoweredUserName,
                            expUser.Id };

gv1开发者_如何学编程.DataSource = studentDetails;
gv1.DataBind();

I have no idea why this did not work. When i remove where clause everything is running. I have try to put where expUser.Id == studID is also did not work

if anyone can help me pls


Shouldn't that be where expUser.aspnetUserId.Equals(studID)?

If ID is the correct column then (as already commented) of what type are expUser.ID and the variable studID? Are they of the same type? If so then does the studID value exist in db.explore_users?

0

精彩评论

暂无评论...
验证码 换一张
取 消