Unless the data used by the application is read only, we typically perform some modifications to the data or add to the data before sending it back to the data source or to another process or application. In windows Forms, the data binding architecture takes care of sending changes in the data bound controls to the DataSet. But, when the controls are not data bound, we have to send the changes in the records to the DataSet manually. Each record in a DataSet is represented by a DataRow object. The DataRows collection can be used for updating DataSet. If we update, add or delete existing rows, we will be updating the DataSet.
You can manipulate the collection directly to delete records. However, if you want to send changes to the database or to another process, the DataSet has to maintain change information for deleted rows. Data tables therefore provide special methods for deleting records so this information can be retained. If the DataSet includes constraints, you can temporarily turn constraints off before making any updates, and then turn them back on afterwards. |