O'Reilly logo

ADO.NET in a Nutshell by Bill Hamilton, Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required