C# 当表绑定到数据源时,SetOrdinl无法正常工作

C# 当表绑定到数据源时,SetOrdinl无法正常工作,c#,C#,当我尝试添加新列并使用SetOrdinal(2) 新添加的列位于最后一列中 conn = new MySqlConnection(connectString); conn.Open(); fireAdapter = new MySqlDataAdapter(query, conn); fireBuilder = new MySqlCommandBuilder(fireAdapter); fireDataTable = new DataTable(); fireAdapter.Fill

当我尝试添加新列并使用
SetOrdinal(2)

新添加的列位于最后一列中

 conn = new MySqlConnection(connectString);
 conn.Open();
 fireAdapter = new MySqlDataAdapter(query, conn);
 fireBuilder = new MySqlCommandBuilder(fireAdapter);
 fireDataTable = new DataTable();
 fireAdapter.Fill(fireDataTable);
 fireSource = new BindingSource();
 fireSource.DataSource = fireDataTable;
 grid.DataSource = fireSource;
 conn.Close();

 DataColumn newcol = new DataColumn("Blah", typeof(string));
 fireDataTable.Columns.Add(newcol);
 newcol.SetOrdinal(2);

我很确定您的代码达到了预期效果,它更改了新列在
数据表中的位置。但它仍然显示为网格中的最后一列。那么,在完全初始化了
数据表之后,为什么不初始化
绑定源代码

DataColumn newcol = new DataColumn("Blah", typeof(string));
fireDataTable.Columns.Add(newcol);
newcol.SetOrdinal(2);
// and now start assign it to the BindingSource 

我甚至尝试了所有的解决方案,但没有运气。请看我的代码above@ywwy那行代码不起作用,你不能在添加(newcol)
后设置序号,它给出了一个快速的errorWell,