Using DataSets in ADO.NETÂ
The ADO.NET DataSet is a memory-resident representation of data that provides a consistent relational programming model regardless of the source of the data it contains. A DataSet represents a complete set of data including the tables that contain, order, and constrain the data, as well as the relationships between the tables.
There are several ways of working with a DataSet, which can be applied independently or in combination. You can:
Programmatically create a DataTable, DataRelation, and Constraint within a DataSet and populate the tables with data.
Populate the DataSet with tables of data from an existing relational data source using a DataAdapter.
Load and persist the DataSet contents using XML. For more information, see Using XML in a DataSet.
A strongly typed DataSet can also be transported using an XML Web service. The design of the DataSet makes it ideal for transporting data using XML Web services. For an overview of XML Web services, see XML Web Services Overview. For an example of consuming a DataSet from an XML Web service, see Consuming a DataSet from an XML Web Service.
In This Section
- Creating a DataSet
Describes the syntax for creating an instance of a DataSet.
- Adding a DataTable to a DataSet
Describes how to create and add tables and columns to a DataSet.
- Adding a Relationship Between Tables
Describes how to create relations between tables in a DataSet.
- Navigating a Relationship Between Tables
Describes how to use the relations between tables in a DataSet to return the child or parent rows of a parent-child relationship.
- Using a DataSet with Existing Data
Describes how to resolve changes in a DataSet back to a data source using a DataAdapter.
- Merging DataSet Contents
Describes how to merge the contents of one DataSet, DataTable, or DataRow array into another DataSet.
- Copying DataSet Contents
Describes how to create a copy of a DataSet that can contain schema as well as specified data.
- Working with DataSet Events
Describes the events of a DataSet and how to use them.
- Working with a Typed DataSet
Discusses what a typed DataSet is and how to create and use it.
- Creating and Using DataTables
Describes how to create a DataTable, define the schema, and manipulate data.
- Creating and Using DataViews
Describes how to create and work with DataViews and work with DataView events.
- Using XML in a DataSet
Describes how the DataSet interacts with XML as a data source, including loading and persisting the contents of a DataSet as XML data.
Related Sections
- What's New in ADO.NET
Introduces features that are new in ADO.NET.
- Overview of ADO.NET
Provides an introduction to the design and components of ADO.NET.
- Securing ADO.NET Applications
Describes secure coding practices when using ADO.NET.
- Connecting and Retrieving Data in ADO.NET
Describes how to connect to a data source and retrieve data, including DataReaders and DataAdapters.
- Modifying Data in ADO.NET
Describes how to modify data in a database and how to use transactions.
- Using the .NET Framework Data Provider for SQL Server
Describes how to work with features and functionality that are specific to SQL Server.
- Using the .NET Framework Data Provider for Oracle
Describes features and behaviors that are specific to the .NET Framework Data Provider for Oracle.
- Using SQL Server Common Language Runtime Integration
Describes how data can be accessed from within a common language runtime (CLR) database object in SQL Server 2005.
- Writing Provider Independent Code in ADO.NET
Describes generic classes that allow you to write provider-independent code in ADO.NET.
- Performing General Tasks in ADO.NET
Describes how to use various general-purpose features of ADO.NET.
- Finding Additional ADO.NET Information
Provides links to additional online information about ADO.NET.