C#如何使用"不在"在LINQ

时间:2018-01-11 21:34:49

标签: c# sql linq

请告诉我如何使用"而不是"使用LINQ

鉴于SQL:

select count(*) from Customer
where (ID = @Id and substring(CustomerIndicator, 1, 1) 
not in(@custInd1, @custInd2, @custInd3))

我的尝试:

        var results = (from r in dt.AsEnumerable()
                       where r.Field<string>("ID") == row["ID"].ToString()
                            && !(r.Field<string>("CustomerIndicator").Substring(1, 1) == "X" || "Y" || "Z")
                       select r).Count(); 

0 个答案:

没有答案