An introduction to ADO.NET concluded - ADO.NET datasets
(Page 2 of 4 )
Now that you have a general idea of how the data provider classes provide access to a database, you need to learn more about the disconnected part of ADO.NET processing: the ADO.NET dataset. So in the topics that follow, you’ll first learn how a dataset is organized. Then, you’ll see an overview of the classes you use to define dataset objects. Finally, you’ll learn how ADO.NET handles concurrency issues that arise when you work with disconnected data.
How a dataset is organized
Figure 2-6 illustrates the basic organization of an ADO.NET dataset. The first thing you should notice in this figure is that a dataset is structured much like a relational database. It can contain one or more tables, and each table can contain one or more columns and rows. In addition, each table can contain one or more constraints that can define a unique key within the table or a foreign key of another table in the dataset. If a dataset contains two or more tables, the dataset can also define the relationships between those tables.
Although a dataset is structured much like a relational database, it’s important to realize that each table in a dataset corresponds to the result set that’s returned from a Select statement, not necessarily to an actual table in a database. For example, a Select statement may join data from several tables in a database to produce a single result set. In this case, the table in the dataset would represent data from each of the tables involved in the join.
You should also know that each group of objects in the diagram in this figure is stored in a collection. All of the columns in a table, for example, are stored in a collection of columns, and all of the rows are stored in a collection of rows. You’ll learn more about these collections in the next figure and in later chapters.
The basic dataset object hierarchy

Figure 2-6. How a dataset is organized
Description
- A dataset object consists of a hierarchy of one or more data table and data relation objects.
- A data table object consists of one or more data column objects and one or more data row objects. The data column objects define the data in each column of the table, including its name, data type, and so on, and the data row objects contain the data for each row in the table.
- A data table can also contain one or more constraint objects that are used to maintain the integrity of the data in the table. A unique key constraint ensures that the values in a column, such as the primary key column, are unique. And a foreign key constraint determines how the rows in one table are affected when corresponding rows in a related table are updated or deleted.
- The data relation objects define how the tables in the dataset are related. They are used to manage constraints and to simplify the navigation between related tables.
- All of the objects in a dataset are stored in collections. For example, the data table objects are stored in a data table collection, and the data row objects are stored in a data row collection. You can refer to these collections through properties of the containing objects.
Next: The dataset classes >>
More .NET Articles
More By Murach Publishing
|
This article is excerpted from chapter two of the book VB.NET Database: Database Programming with ADO.NET, written by Anne Prince and Doug Lowe (Murach Publishing; ISBN: 1890774197). Check it out today at your favorite bookstore. Buy this book now.
|
|