码迷,mamicode.com
首页 > 其他好文 > 详细

Linq代码

时间:2016-07-12 15:11:40      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:

        private void getDtModel()
        {
            dtModel = new DataTable();
            List<object[]> arrValue = (from ee in dtSapProcessModel.AsEnumerable()
                                                                 from ff in dtSapProcessElement.AsEnumerable()
                                                                 from gg in dtSapProcessFileNumber.AsEnumerable()
                                                                 where (gg.Field<string>("WorkShop") == sWorkShop
                                                                 && gg.Field<string>("Standard") == sStandard
                                                                 && ee.Field<int>("FK_ElementId") == ff.Field<int>("ID")
                                                                 && gg.Field<int>("FK_ElementID") == ff.Field<int>("ID")
                                                                 && ee.Field<bool>("IsDeleted") == false
                                                                 && ff.Field<bool>("IsDeleted") == false
                                                                 && gg.Field<bool>("IsDeleted") == false)
                                                                 orderby ee.Field<int>("OrderNumber")
                                                                 select new object[]
                                                                 {
                                                                        0,
                                                                        ee.Field<int>("OrderNumber"),
                                                                        ee.Field<string>("ModelName"),
                                                                        ee.Field<string>("Header"),
                                                                        ff.Field<string>("ProcessC"),
                                                                        ff.Field<string>("ProcessE"),
                                                                        gg.Field<string>("FileNumber"),
                                                                        ff.Field<string>("DescriptionC"),
                                                                        ff.Field<string>("DescriptionE"),
                                                                 }
                                                        ).ToList();
            dtModel.Columns.Add("ID", typeof(int));
            dtModel.Columns.Add("OrderNumber", typeof(int));
            dtModel.Columns.Add("ModelName");
            dtModel.Columns.Add("Header");
            dtModel.Columns.Add("ProcessC");
            dtModel.Columns.Add("ProcessE");
            dtModel.Columns.Add("FileNumber");
            dtModel.Columns.Add("DescriptionC");
            dtModel.Columns.Add("DescriptionE");
            foreach (var item in arrValue)
            {
                dtModel.Rows.Add(item);
            }
        }

 

Linq代码

标签:

原文地址:http://www.cnblogs.com/swtool/p/5663420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!