共用方式為


Creating and Using DataSets

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 methods of working with a DataSet, which can be applied independently or in combination. You can:

  • Programmatically create DataTables, DataRelations, and Constraints 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 XML and the 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

  • Accessing Data with ADO.NET
    Describes the ADO.NET architecture and components and how to use them to access existing data sources as well as to manage application data.
  • XML and the DataSet
    Describes how the DataSet interacts with XML as a data source, including loading and persisting the contents of a DataSet as XML data.
  • ADO.NET Architecture
    Describes the components of ADO.NET, including the DataSet, and the roles they play in the ADO.NET architecture.
  • Populating a DataSet from a DataAdapter
    Describes how to populate a DataSet with tables of data from an existing data source using a DataAdapter.