请告诉我如何使用"而不是"使用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();