【发布时间】:2016-09-27 21:05:13
【问题描述】:
我有一个 SQL 表:
Id FirstName LastName DateTime
1 John Doe 2016-09-27 20:45:52.293
2 John Doe 2016-09-27 20:45:53.620
3 John Doe 2016-09-27 20:46:02.370
4 John Doe 2016-09-27 20:46:02.533
5 John Doe 2016-09-27 20:46:02.680
6 John Doe 2016-09-27 20:46:02.820
还有一个List<Int>:
List<int> ids = new List<int>(){ 2, 3, 5 }
我使用 Linq To Sql 类来获取我的 sql 表中的所有记录。我愿意:
using(DataClassesDataContext Context = new DataClassesDataContext())
{
var Customers = Context.Customers;
}
我想知道列表中的所有 id 是否都存在于表中,如果没有,找出哪一行不存在
最好的方法是什么?
【问题讨论】:
标签: c# sql-server linq