Linq代码
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); } }