inq to sql生成类似where id not in (1,3,5)或where id not in (select id from ...)
int[] id = new int[] { };
DataTable dt = tools.GetTable(sql);
if (dt != null)
{
id = new int[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
{
id[i] = dt.Rows[i]["blogid"].Int32();
}
} sql = "";
var result = (from blog in db.BlogArticle.AsEnumerable() where !id.Contains(blog.ArticleId) orderby blog.ArticleId select blog);
最终翻译出来的语句并非跟not in 完全一样的,而是用not exists(...),不过效果完全相同,能达到要求就行了