datatable

DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(System.String));
DataRow row = dt.NewRow();
row["id"] = "sdsd";
dt.Rows.Add(row);
DataTable thedatatable = dt.Copy();
string[] columname = { "id" };
for (int i = 0; i < dt.Columns.Count; i++)
{
thedatatable.Columns[i].ColumnName = columname[i];
}
Output.DataTabletoExcel(thedatatable, 0, "");

posted @ 2016-08-12 09:43  尘梦  阅读(142)  评论(0编辑  收藏  举报