linq to dataset 动态查询的一个问题

dc22wt dc22wt 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

//这个表示选择第一个条件筛选出来的user_no
var query1 =
(from t in ds.Tables[0].AsEnumerable()
group t by t.Field<string>("user_no") into g
let fact_charge = g.Sum(p => p.Field<decimal>("fact_charge"))
where fact_charge > c
select new { user_no = g.Key }).Distinct();//Select(p=>p.Field<string>("user_no")
//这个表示选择第二个条件筛选出来的user_no
var query2 =
(from t in ds.Tables[0].AsEnumerable()
group t by t.Field<string>("user_no") into g
where g.Count() > d
select new { user_no = g.Key }).Distinct();
//这个表示选择第三个条件筛选出来的user_no
var query3 =
(from t in ds.Tables[0].AsEnumerable()
where Convert.ToInt32(t.Field<string>("gather_month")) <= b1
select new { p = t.Field<string>("user_no") }).Distinct();
客户可以随意选择这三个选项,求user_no得交集,最后将得到的user_no(暂定最后的结果为数据集query)再作为
var query4 =
from t in ds.Tables[0].AsEnumerable()
from o in query.AsEnumerable()
where o.user_no.ToString().Contains(t.Field<string>("user_no"))
orderby t.Field<string>("volpage"), t.Field<string>("user_no"), t.Field<string>("gather_month")
select t;
的查询子条件。急等各位大牛的援助。
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
dc22wt
LINQ 8,492 成员 4,736 内容