Editing Data in Your Application
After your dataset is populated with data, you will typically add, edit, or delete some of the data before sending it back to the data source or to another process or application. Since each record in a dataset is represented by a DataRow object, changes to a dataset are accomplished by working with individual rows.
Note
In Windows Forms, the data-binding architecture takes care of sending changes from data-bound controls to the dataset, and you do not have to explicitly update the dataset with your own code. For more information, see Windows Forms Data Binding.
Datasets maintain multiple versions of data rows in order to locate the original records in a data source. Before performing an update to the data source, you may want to examine specific rows. The topics in this section provide details on determining if records have changed, as well as retrieving particular versions of records.
The following topics provide details on adding, editing, and deleting rows in data tables, and how to work with rows in various stages of an application.
In This Section
Editing Data in Datasets Overview
Provides information on the many tasks that manipulate data in a dataset.How to: Add Rows to a DataTable
Provides the steps to create DataRow objects and add them to a data table.How to: Edit Rows in a DataTable
Provides the steps for editing an existing row of data in a data table.How to: Delete Rows in a DataTable
Provides the steps to remove specific rows of data in a data table.How to: Turn Off Constraints While Filling a Dataset
Provides details for temporarily disabling constraint checking in a dataset.How to: Commit Changes in a Dataset
Provides information and details for accepting changes that have been made to data in a dataset.How to: Check for Changed Rows
Provides the steps to determine if data has been changed in a dataset.How to: Retrieve Changed Rows
Provides details for returning rows of data that have been changed since last accepting any changes.How to: Locate a Specific Row in a DataTable
Provides details for finding data in a data table using either a primary key value, or a column value.How to: Get Specific Versions of a DataRow
Provides details for returning specific rows of data using the DataRowVersion enumeration.How to: Locate Rows that Have Errors
Provides details for finding data in a data table that has been marked with an error.
Reference
DataSet
Represents an in-memory cache of data.DataTable
Represents one table of in-memory data.DataRow
Represents a row of data in a DataTable.DataColumn
Represents the schema of a column in a DataTable.DataRowVersion
Describes the version of a DataRow.RowState
Gets the state of a DataRow object.AcceptChanges
Commits all the changes made to this DataSet since it was loaded or since the last time AcceptChanges was called.HasChanges
Gets a value indicating whether the DataSet has changes, including new, deleted, or modified rows.GetChanges
Gets a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called.HasErrors
Gets a value indicating whether there are errors in any of the DataTable objects within this DataSet.
Related Sections
ADO.NET DataSets
Provides topics about what datasets are and how to use them.DataSets, DataTables, and DataViews (ADO.NET)
Describes how to create and customize DataSet objects.DataTables (ADO.NET)
Describes how to create and customize DataTable objects.Preparing Your Application to Receive Data
Provides links to topics explaining what datasets are, how to create new datasets, and how to create and edit the individual objects they are made of.Getting Started with Data Access
Provides links to topics on creating applications that work with data, using Visual Studio.Connecting to Data in Visual Studio
Provides links to topics on connecting your application to data with design time tools, and ADO.NET connection objects, using Visual Studio.Fetching Data into Your Application
Provides links to topics describing how to load data into datasets, and how to execute SQL statements and stored procedures.Displaying Data on Forms in Windows Applications
Provides links to topics that explain how to display data on Windows Forms through data-bound controls.Validating Data
Provides links to topics describing how to add validation to a dataset during column and row changes.Saving Data
Provides links to topics explaining how to send updated data from an application to the database.