Visual Basic and Visual C# Concepts
Updating, Inserting, and Deleting Records in a Dataset

After your dataset is populated with data, you will typically perform some kind of manipulation 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 updating and deleting individual rows. Additionally, new records can be inserted into the dataset by adding new DataRow objects to the DataTable objects' Rows collection.

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.

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 Architecture.

If the dataset includes constraints, you can temporarily turn constraints off before making any updates, and then turn them back on afterward. For more information, see Suspending Update Constraints.

In This Section

Updating Existing Records in a Dataset
Describes how to access and change values to individual records.
Inserting New Records into a Dataset
Describes how to create a new DataRow object and assign values to the individual columns it contains.
Deleting Records in a Dataset
Describes the proper way to remove records from a dataset while maintaining information needed to locate and remove the record fom the data source.
Data Update Events
Describes the events that are raised in a dataset when you make changes to records.
Suspending Update Constraints
Describes how to temporarily turn off constraint checking while making changes to individual columns in a record.
Merging Datasets
Describes how to copy records from one dataset to another.
Committing Changes in a Dataset
Describes how to reset change information in a dataset so that all its records are flagged as being unchanged.
Identifying and Returning Changed Rows
Provides links to procedural topics that detail how to determine whether changes were made to individual records, and how to find and retrieve rows with specific changes.
Validating Data
Provides links to topics that explain and describe dataset events that can be used for validating data.

Related Sections

ADO.NET Datasets
Provides topics about what datasets are and how to use them.
Introduction to Dataset Updates
Provides an overview of how changes are made in a dataset and how the dataset tracks information about changes in order to send change information to other processes.
Data Update Events
Describes the events that are raised in a dataset when you make changes to records.
Suspending Update Constraints
Describes how to temporarily turn off constraint checking while making changes to individual columns in a record.
Database Updates from Datasets
Provides an overview of how to move dataset changes to a database.
Creating and Filling Datasets Example Topics
Presents a series of specific example code topics for common tasks in creating and filling datasets with Visual Basic .NET.
Manipulating Data Example Topics
Presents a series of specific example code topics for common tasks in working with data within your application using Visual Basic .NET.
Page view tracker