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

Comments/Troubleshooting

The DataSet class provides a consistent programming model, regardless of the actual data source. The DataSet schema can be created programmatically, read from a data source, read from an XML schema, or inferred from an XML document or stream.

The DataSet serves as a container for disconnected objects. It can contain DataTable objects in its DataTableCollection and can be accessed through its Tables property. These tables can be related to one another using DataRelation objects in the DataRelationCollection and are accessed through the Relations property of the DataSet. Data integrity can be maintained by adding ForeignKeyConstraint and UniqueConstraint objects to the DataTable objects.

The data in the DataSet can be populated from the data source, modified, and later reconciled back to a data source, using a DataAdapter. Alternatively, the data can be populated from XML documents or streams, modified, and saved as an XML document or stream. Finally, the data stored in the DataSet can be created and manipulated programmatically.

The DataSet and XML are tightly coupled, which permits the same data to be accessed and manipulated using either the DataSet and its contained objects or by using XML-based classes. This has two particularly important implications. First, XSLT templates can easily be applied to any DataSet to transform the data structure. Second, the schema, data, or both the schema and data within a DataSet can be persisted to memory or a file as ...

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