public DataTable LoadPaymentsList()
{
List< DataTable > lstDts = new List< DataTable >();
// Copy into dt
Datatable dt=new Datatable();
return dt;
}
答案 0 :(得分:1)
我认为没有比简单Row
更好的方式 - 和Column
- 添加:
DataTable mergedTable = new DataTable();
List<DataTable> tableCollection = new List<DataTable>();
/*---------------------------------*/
bool columnsAdded = false;
foreach (DataTable table in tableCollection)
{
if (!columnsAdded)
{
foreach (DataColumn column in table.Columns)
{
mergedTable.Columns.Add(column);
}
columnsAdded = true;
}
foreach (DataRow row in table.Rows)
{
mergedTable.Rows.Add(row);
}
}
答案 1 :(得分:0)
您想了解一下合并表格。有关dataTable合并的更多信息,请查看此信息,http://www.c-sharpcorner.com/UploadFile/0c1bb2/merging-multiple-datatables-into-single-datatable-using-asp/
//merging first data table into second data table
dt2.Merge(dt);
dt2.AcceptChanges();