/// <summary>
/// 给DataTable添加新的行和列
/// </summary>
public void DataTableChangeDt()
{
//---------********动态给DataTable添加数据*********---------
newtb = new System.Data.DataTable();
DataColumn column = new DataColumn("column1", typeof(string));//新增列
newtb = dt;
newtb.Columns.Add(column);
for (int i = 0; i < newtb.Rows.Count; i++)
{
DataRow newRow = newtb.NewRow();
newtb.Rows[i]["column1"] = num[i].ToString();
}
//--------添加行
DataRow NewRows = newtb.NewRow();
//NewRows.ItemArray = new object[] { "1", "你好", "45.12" };
string[] summaryNew = new string[summaryColleciton.Length];
for (int i = 0; i < summaryColleciton.Length; i++)
{
summaryNew[i] = summaryColleciton[i];
}
summaryNew[0] = "合计";
NewRows.ItemArray = summaryNew;
newtb.Rows.Add(NewRows);
//---------********动态给DataTable添加数据*********---------
}