1

我正在尝试过滤 LINQ 查询,但它不接受我的 where 子句,我不知道要使用哪种 Lambda 函数。

这就是我想要的,但这会引发错误。

var query = from s in _db.Students where s.Payments == null orderby s.LastName select s;
4

1 回答 1

1

假设这Payments不是 的字段Students,而是表示Payment与 this 相关的项目集合的属性Student,请尝试以下查询:

var query = from s in _db.Students where !s.Payments.Any() orderby s.LastName select s;
于 2012-06-04T17:19:26.280 回答