What is a Data Set Made From?
A data set comprises many parts, all of which are required for its usage. The fol-
lowing classes will be introduced and discussed in this section:
DataSet
SqlDataAdapter
DataTable
DataColumn
DataRow
DataRelation
DataView
We need to use most of these classes in order to work with data sets. For instance,
the SqlDataAdapter class acts as the communication point between the DataSet
and the database. The data adapter knows how to fill a DataSet with data from
the data source; it also knows how to submit to the data source any changes
youve made to a DataSet.
Data Adapters
Of all these objects, only SqlDataAdapter depends on a particular data
provider, and as such, it is interchangeable with other classes that work with
data providers, including OracleDataAdapter, OleDbDataAdapter, and
so on. As this class is the bridge between the database and your local data
storage objects (the other classes mentioned), it makes sense for the class to
be database-specific. The DataSet, DataTable, and other classes, store the
data locally and dont need to be aware of the source of that data.
A DataSet will always contain at least one DataTable, but it can contain many.
These DataTables contain DataColumns and DataRows. If we needed to establish
a relationship between multiple DataTables within a DataSet, wed use
DataRelations. Finally, wed create DataViews to query the DataSet.
497
What is a Data Set Made From?

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition 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.