조건에 따라 합계 또는 평균을 사용하여 DataTable
을 목록에 병합하고 싶습니다. 예를 들면 다음과 같습니다.조건이있는 데이터 테이블 병합
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를 사용하면 통합뿐만 아니라 결합도 할 수 있습니다. –