DataRow behavior

xiaoxiao2021-03-06  46

A DATAROW object is just created, its status is detached, is an isolated one existence, so after the DataRow is created, the data is filled with the data in DataRow and add this DataRow to DataTable. After DATAROW is added to DataTable, the status of this DATAROW is converted to Added. When this DATAROW is modified, this DATAROW status is converted to modified. When DataRow.delete () method is deleted, the DATAROW status will be turned to deleted, but this line still exists in the DataTable, but the state changes, at this time Use DataTable.Rows.count to view the number of rows, before the deletion is the same. This DATAROW is only removed from the DataTable and the status is also removed from the DataTable.Remove (DataRow) method.

Once the DataTable.AcceptChanges () method is called, all rows will do different processing, add, modified, unchange according to different states, and the DELETED's line will be removed from the DataTable, and the status of all rows are set. To unchanged. Adapter.Update (),

After you said REMOVE, the status of this line is already detached, do not belong to DataTable, so you don't delete records in the database.

转载请注明原文地址:https://www.9cbs.com/read-79897.html

New Post(0)