Name

DataSet

Synopsis

The DataSet contains a collection of DataTable objects that define the schema and contain the data for each table (Tables). The DataSet also contains a collection of DataRelation objects that define the relationships between the tables (Relations). The DataSet references a DataViewManager that specifies how views should be created when data binding to a control (DefaultViewManager). The DataSet is often described as an in-memory cache of relational data.

The DataSet is the only ADO.NET object with the ability to serialize its content to an XML file (using the WriteXml( ) and WriteXmlSchema( ) methods) or to populate itself from an existing schema or XML file (using the ReadXmlSchema( ) and ReadXml( ) methods). Alternatively, you can use GetXml( ) and GetXmlSchema( ) to retrieve the XML data and schema information as a string.

You can delete the data in a DataSet without affecting the schema (using Clear( )), create a duplicate DataSet with the same table structure and meta data (using Clone( )) or with the same structure and content (using Copy( )), merge two DataSet objects (using Merge( ) ), or check the entire DataSet for errors (using HasErrors).

One of the most important features of the DataSet is its version-tracking ability. By default, each DataRow object in the DataSet stores enough information to track any modifications made to it, and whether it is scheduled for insertion or deletion when reconciled with the data source. The DataAdapter uses this information ...

Get ADO.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.