Database Access with Visual Basic .NET (3rd Edition)
Chapter 5. ADO.NET The DataSet
IN THIS CHAPTER
The DataSet object is the central, if not the most revolutionary, element of the ADO.NET approach to data access. The DataSet is an in-memory cache of data from one or more data sources. You can think of it as a full-featured, in-memory database. Perhaps its most distinctive characteristic is that it is used in a totally disconnected fashion. The managed .NET Data Provider objects discussed in Chapter 4 provide functionality while being physically connected to a database or other data source. In contrast, the DataSet and its related objects (such as the DataTable, DataRow, DataColumn, and DataRelation objects) provide rich functionality while being physically disconnected from the actual data source. Another key characteristic of the DataSet is that, once it has been loaded with data, it doesn't know where that data came from. It just contains data and allows you to manipulate it in a relational manner. Thus the DataSet and its objects are generic and not specific to any particular data provider. That is, there is only a DataSet object not a SqlDataSet, OledbDataSet, and so on. If a DataSet doesn't know the source of its data, how is it loaded? Moreover, how are changes updated back to the data source? The answers to these questions normally comes from the DataAdapter object, which is the bridge between DataSet and the physical data source. The DataAdapter is supplied commands to read the data from the data source, as well as commands to update, delete, and insert data to that data source. We cover the DataAdapter in detail in Chapter 6. |