2010年12月16日

摘要: 转[Linq To SQL]生成[Not In]语句2010-03-11 23:24以前一直觉得linq to sql生成类似 where id not in (1,2,3) 或 where id not in (select id from ...) 这样的条件不是很方便,每次我都是把条件ID事先取到一个数组里,然后用 !Arr.Contains(c.Id)这样处理,其实可以完全直接用linq写成一句,如下:from a in TableA where !(from b in TableB Where ... select b.Id).Contains(a.Id)最终翻译出来的语句并非跟no 阅读全文

posted @ 2010-12-16 20:47 gmtyt 阅读(409) 评论(0) 推荐(0)


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3