How to change the DataTable Column Name?
Solution 1:
Try this:
dataTable.Columns["Marks"].ColumnName = "SubjectMarks";
Solution 2:
Rename the Column by doing the following:
dataTable.Columns["ColumnName"].ColumnName = "newColumnName";
Solution 3:
dtTempColumn.Columns["EXCELCOLUMNS"].ColumnName = "COLUMN_NAME";
dtTempColumn.AcceptChanges();
Solution 4:
Use:
dt.Columns["Name"].ColumnName = "xyz";
dt.AcceptChanges();
or
dt.Columns[0].ColumnName = "xyz";
dt.AcceptChanges();