2
我在TSQL以下查詢多加入實體框架
select * from users
inner join linkUserPhoneNumber on users.UserId = linkUserPhoneNumber.UserId
INNER JOIN PhoneNumber ON PhoneNumber.PhoneNumberId =
linkUserPhoneNumber.PhoneNumberId
where UserName = 'superuser' and password ='password'
我在實體框架下面的查詢
var query = (from u in myEntities.Users
join link in myEntities.linkUserPhoneNumbers on u.UserId equals link.UserId
join p in myEntities.PhoneNumbers on p.PhoneNumberId equals link.PhoneNumberId
where u.UserName == Username && u.Password == Password
select u).ToList();
當我嘗試編譯它,我得到
錯誤3名稱'p'不在'等於'左側的範圍內。考慮交換'equals'兩邊的表達式。
錯誤4名稱'鏈接'不在'等於'右側的範圍內。考慮交換'equals'兩邊的表達式。
我想你複製粘貼,這樣我就可以看到一個 'eqals'這可能是'等於' – Amedio 2012-07-18 09:03:00