var q = from u in dt_data.AsEnumerable() group u by u.Field<string>("Code"); //分组信息 foreach (var gp in q) { sb.AppendLine(gp.Key); //每个分组内的信息 foreach (var item in gp) { sb.AppendLine(item.Field<string>("Code") + " " + item.Field<DateTime>("Time").ToString("yyyy-MM-dd")); } }
时间: 2024-10-05 01:26:22