更新时间:2023-12-03 12:05:40
添加新行后调用AcceptChanges
实际上会变成你新添加的DataRow的
DataRowState
从 Added
到 Unchanged
.如果您继续使用它,您可能失去对新添加行的跟踪,并且在持久化时.ADO.NET 无法识别需要插入数据库的行.所以明智地选择这个选项,你甚至可能不需要它.
Calling AcceptChanges
after adding new row will actually turn the DataRowState
of your newly added DataRow
from Added
to Unchanged
. If you go with it you might lose the tracking of your newly added rows and at the time of persistance. ADO.NET would not be able to identify the rows which needs to be inserted in the database. So choose this option wisely you might not even require it.