linq根据多列 分组datatable

 var query = from t in dtAll.AsEnumerable()
                        group t by new
                        {
                            t1 = t.Field<string>("SourceOrderId"),
                            t2 = t.Field<string>("SupplierDomain"),
                            t3 = t.Field<string>("ReceiverDomain"),
                            t4 = t.Field<string>("StorehouseId")
                        } into m
                        select new
                        {
                            SourceOrderIdEnd = m.Key.t1,
                            SupplierDomain = m.Key.t2,
                            ReceiverDomain = m.Key.t3,
                            StorehouseId = m.Key.t4,
                            rowcount = m.Count()
                        };
            query.ToList().ForEach(x =>
            {

            });

 

posted on 2013-04-25 12:28  梁子se7en  阅读(216)  评论(0编辑  收藏  举报