我如何添加WHERE IN语句,如…
SELECT * FROM myTable WHERE ID IN (1,2,3,4,5)
在实体框架中
用途Contains:
Contains
int[] ids = { 1, 2, 3, 4, 5}; var query = db.myTable.Where(item => ids.Contains(item.ID));
或在查询语法中:
int[] ids = { 1, 2, 3, 4, 5}; var query = from item in db.myTable where ids.Contains(item.ID) select item;