我认为这会相当容易,但我在这里......我试图简单地向现有行添加一个新行, DataTable
但表格不会占用我的行......
Debug.Print("My Achv Count Before: {0}", Manager.achievementsMine.Rows.Count);
DataRow newRow = Manager.achievementsMine.NewRow();
newRow.SetField<int>("CT_Q", count);
newRow.SetField<DateTime>("CMPL_D", DateTime.Now);
newRow.SetField<string>("USER_LAN_I", Manager.userID);
newRow.SetField<string>("ACHV_I", ACHV_I);
Manager.achievementsMine.ImportRow(newRow);
Manager.achievementsMine.AcceptChanges();
Debug.Print("My Achv Count After: {0}", Manager.achievementsMine.Rows.Count);
'Debug.Print'之前/之后的两条线都显示我的计数为44。为什么'after'调试不告诉我45,因为我刚刚导入了一个新行并告诉我DataTable
接受更改?
编辑:我尝试重写一些newRow
部分但没有改变:
Debug.Print("My Achv Count Before: {0}", Manager.achievementsMine.Rows.Count);
DataRow newRow = Manager.achievementsMine.NewRow();
newRow["CT_Q"] = count;
newRow["CMPL_D"] = DateTime.Now;
newRow["USER_LAN_I"] = Manager.userID;
newRow["ACHV_I"] = ACHV_I;
Manager.achievementsMine.ImportRow(newRow);
Manager.achievementsMine.AcceptChanges();
Debug.Print("My Achv Count After: {0}", Manager.achievementsMine.Rows.Count);