DataSet.GetChanges() 返回 null C#
我试试这个
DataSet ds = new DataSet();
ds.AcceptChanges();
//edit table in ds
ds.Tables[0].Rows.RemoveAt(0);
//get changes
DataSet ds2 = ds.GetChanges();
but ds2 is null, why?
I try this
DataSet ds = new DataSet();
ds.AcceptChanges();
//edit table in ds
ds.Tables[0].Rows.RemoveAt(0);
//get changes
DataSet ds2 = ds.GetChanges();
but ds2 is null, why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用Delete而不是RemoveAt:
RemoveAt()确实删除了Row,没有留下任何痕迹,因此没有Change信息。 Delete() 只是将该行标记为已删除。
Use Delete instead of RemoveAt:
RemoveAt() really removes the Row, there is no trace of it left and hence there is no Change information. Delete() just marks the row as deleted.
也许表格已经是空的,删除第一行没有改变任何东西吗?
Maybe the table was already empty, do removing the first row didn't change anything?