我想要合并DataTable
s在列表中使用总和或平均值取决于条件。例如:将数据表与条件合并
private DataTable getData(List<DataTable> datas, string[] KeyColumnNames, string valueCol)
{
List<DataTable> dataTables = datas;
//if datas has 3 dataTables in it : dt1, dt2, dt3
// then I want to create another dataTable dtAll which will have the sum of
// valueCol of all three datatables for the row which will be conditioned using
// KeyColumnNames (can be multiple Primary keys)
return dataTable;
}
考虑所有的数据表,因为它们是从类似的模式,但不同的数据中心的表是完全一样的,但不同的值。 谢谢。
考虑使用LINQ它有能力聚合以及联合。 –