After a datarow object is created, its status is detached, which is an isolated object. Therefore, after datarow is created, the unit in datarow fills in data and then uses datatable. rows. the add (datarow) method adds this datarow to the able. After datarow is added to the able, the status of this datarow is changed to added.
After the datarow is modified, the datarow status changes to modified. after the delete () method deletes datarow, The datarow status changes to deleted. However, this row still exists in the able, but the status changes. In this case, the datatable is used. rows. count to view the number of rows, which is the same as before deletion.
This datarow is removed from the datatable only after the able. Remove (datarow) method is called, and its status also returns to the detached isolated state.
MsdnDescription of datarow. Delete method:If the row rowstate is "added", the row is removed from the table. When the delete method is used, rowstate becomes "deleted ". It remains "deleted" until you call acceptchanges ". You can call rejectchanges to cancel row deletion.
With Delete (), haschanges () of dataset is true;
Remove () is used. haschanges () of dataset is set to false;