How to rename the datatable column name without losing the data?

后端 未结 4 1011
借酒劲吻你
借酒劲吻你 2021-01-12 17:41

Q:

I want to rename my data table column names .

I tried this :

dt.Columns[8].ColumnName = \"regnum\";

dt.AcceptChanges();
<
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 18:21

    Try this:

     dataTable.Columns["ExistingColumnName"].ColumnName = "regnum";
    

提交回复
热议问题