var model = _db.Seuni
.Join(from o in _db.Keuni
join
c in _db.Seuni
on o.klasaid equals c.klasaid
select new {o.emriklases,c.emristudent,c.studentid,c.nota })
.OrderByDescending(r => r.nota)
我有这个代码示例,我已经搜索过找到这个linq扩展方法的正确语法,而且我还没有给我一个正确的语法?提前谢谢你
答案 0 :(得分:1)
您的查询和方法语法混合错误。
var model = _db.Seuni
.Join(_db.Keuni,
c => c.klasaid,
o => o.klasaid,
(c, o) => new { o.emriklases, c.emristudent, c.studentid, c.nota })
.OrderByDescending(r => r.nota);
或者使用查询(订购方法)语法
// query syntax
var model = (from o in _db.Keuni
join c in _db.Seuni on o.klasaid equals c.klasaid
select new { o.emriklases, c.emristudent, c.studentid, c.nota })
.OrderByDescending(r => r.nota);