dt1.AsEnumerable().Join(dt2.AsEnumerable(), r1 => r1.Field<object>("id"), r2 => r2.Field<object>("id"), (r1, r2) => r1); //查找非小题非组合题,分数为空的序号 List<int> nilScoreRow = detailTable.AsEnumerable().Where(x => LibSysUtils.ToDecimal(x["pre_score"]) == 0). Where(x => LibSysUtils.ToBoolean(x["is_minor"]) == false). Where(x => x.RowState != DataRowState.Deleted). Where(x => LibSysUtils.ToInt(x["quiz_type"]) != (int)EnumERSType.CombinationType). Select(x => LibSysUtils.ToInt(x["sort_no"])).ToList(); //组合题 EnumerableRowCollection<DataRow> combinationList = detailTable.AsEnumerable(). Where(x => LibSysUtils.ToInt(x["quiz_type"]) == (int)EnumERSType.CombinationType). Where(x => x.RowState != DataRowState.Deleted); //查找有小题分数的组合题 List<int> nilCombinationList = detailTable.AsEnumerable().Where(x => LibSysUtils.ToBoolean(x["is_minor"]) == true). Where(x => LibSysUtils.ToDecimal(x["pre_score"]) == 0). Where(x => x.RowState != DataRowState.Deleted). Join(combinationList, x => x.Field<object>("parent_id"), y => y.Field<object>("quiz_id"), (x, y) => y) .Select(y=> LibSysUtils.ToInt(y["sort_no"])).Distinct().ToList(); nilScoreRow.AddRange(nilCombinationList);