DataSet Class
Namespace: System.Data
Assembly: System.Data.dll
Summary
Represents an in-memory cache of data. It consists of one or more DataTable objects, representing tables of data, along with relationships and constraints between them.
Syntax
[SerializableAttribute]
public class DataSet : MarshalByRefObject, IListSource, ISupportInitialize, IEnumerable
Properties
CaseSensitive
Gets or sets a value indicating whether string comparisons within the DataSet are case sensitive.
DataSetName
Gets or sets the name of the DataSet.
DefaultViewManager
Gets a DataViewManager for the DataSet.
EnforceConstraints
Gets or sets a value indicating whether to enforce constraints.
ExtendedProperties
Gets a collection that contains custom user code or per-object data.
Methods
Clone()
Creates and returns a copy of this DataSet. Only the structure of the DataSet, including all table, column, and constraint schemas, is copied. Data is not included.
Copy()
Copies both the structure and data for this DataSet.
ReadXml(XmlReader)
Reads an XML schema and data into the DataSet.
WriteXml(XmlWriter)
Writes the current DataSet contents to an XML document.
Remarks
The DataSet class is a core component of the ADO.NET data access architecture. It provides a rich, programmable, in-memory representation of data that allows you to manage a dataset independently of the data source. You can use a DataSet to cache data retrieved from multiple data sources, perform filtering, sorting, and searching on the data, and combine data from various sources.
A DataSet can contain:
- One or more DataTable objects, each representing a table of data.
- DataRelation objects, which define relationships between tables, allowing you to navigate from one table to another.
- Constraint objects, such as UniqueConstraint and ForeignKeyConstraint, to maintain data integrity.
The DataSet can be populated with data from a data source using a DataAdapter or can be created and populated manually.