var list = from tab in context.Tbl_Section
                           where (new string[] { "d001", "d002" }).Contains(tab.DepartmentID) && !(new string[] { "S0142", "S0162" }).Contains(tab.SectionID)
                           && tab.UFlag == true
                           orderby tab.DepartmentID ascending
                           select tab;

第一个是实现in的功能 这个是判断数据中是否包含linq查询出来的值

第二个就比较明显了 加上一个!表示取反的功能就是 not in的功能了

posted on 2011-11-23 09:33  万德源  阅读(381)  评论(0编辑  收藏  举报