Partager via


Editing Data in Datasets

Editing the data in a DataSet is the process of manipulating the actual data in the individual DataTable objects that make up a dataset. You edit the data in data tables much as you edit the data in a table in any database — the process can include inserting, updating, and deleting records in the table.

In addition to changing to the actual data, you can also query a DataTable to return specific rows of data, for example, individual rows, specific versions of rows (original and proposed), only rows that have changed, and rows that have errors.

Common Data Table Tasks

The following table provides links to the common tasks associated with editing and querying data in a dataset:

Task

Description

Insert new records into a data table.

Create a new DataRow and add it to the table's collection of rows. For more information, see How to: Add Rows to a DataTable.

Update existing records in a data table.

Assign a value directly to the specific column of a data row. For more information, see How to: Edit Rows in a DataTable.

Delete existing records from a data table.

Call the Delete method of the data row you want to remove from the table. For more information, see How to: Delete Rows in a DataTable.

Locate changed records in a data table.

Call the GetChanges method of a data table. For more information, see How to: Retrieve Changed Rows.

Access different versions of a row in a data table.

Access the individual columns of a data row by passing in the DataRowVersion you want to view. For more information, see How to: Get Specific Versions of a DataRow.

Locate rows with errors in a data table.

Inspect the HasErrors property of a data table. For more information, see How to: Locate Rows that Have Errors.

See Also

Concepts

Preparing Your Application to Receive Data

Fetching Data into Your Application

Editing Data in Your Application

Binding Windows Forms Controls to Data in Visual Studio

Binding Controls to Data in Visual Studio

Validating Data

Saving Data

Other Resources

Creating and Using DataTables

Creating and Using DataTables

Data Walkthroughs

Overview of Data Applications in Visual Studio

Connecting to Data in Visual Studio