日期:2014-05-20  浏览次数:20933 次

linq多表链接问题
以下是一个表中的数据,其中灰色的“复核”按钮数据在另一张表中,怎样调用

------解决方案--------------------
var q = 
from c in db.A 
join o in db.B on c.AID 
equals o.ID into g 
select new 

c.Name, 
g.Count() 
}; 
var q = 
from e in db.Employees 
join o in db.Books on e.EmployeeID equals o.EmployeeID into b 
from x in b.DefaultIfEmpty() 
select new 

e.ID, 
e.Name, 
o.BookName 
};
------解决方案--------------------
var query = from card in DBContext.Cards join c in DBContext.Check on card.ID equals c.CardID select new {ID=card.ID,Name=card.Name,IsCheck=c.IsCheck};