3
我正在從數據庫中檢索表並將其存儲在數據表中。如何更改或替換數據表中的所有列名
我需要更改列名到新的列名在數據表中我嘗試下面的代碼,但它不是changing..where我犯的錯誤....
foreach (DataColumn column in obj_dt.Columns)
column.Caption = column.ColumnName.Replace("Tax","new tax");
foreach (DataGridViewColumn gridColumn in dataGridView_dataGridView_curt_Prd_Dtls.Columns)
gridColumn.HeaderText = obj_dt.Columns[gridColumn.HeaderText].Caption;
dataGridView_dataGridView_curt_Prd_Dtls.DataSource = obj_dt;
感謝,但如何用空格替換_(」「) – Happy