【发布时间】:2012-04-06 14:04:00
【问题描述】:
我有一个非常简单的 C# DataTable 问题,我似乎无法理解;看起来很困难,但我一定错过了什么。
我希望有人可以向我解释为什么我无法更新 DataTable 中的单元格值,如下所示:
代码:
DataTable t = new DataTable();
t.Columns.Add("MyCol");
t.Rows.Add("old value");
t.Rows[0].ItemArray[0] = "new value";
t.AcceptChanges();
dataGridView1.DataSource = t; //did not work. still reads "old value"
任何帮助将不胜感激!谢谢!
【问题讨论】: