Disconnected Data Sets

  • A DataSet stores data in memory and provides a consistent relational programming model that is the same, whatever the original sources of the data.
  • Thus a DataSet contains a collection of tables and relationships between the tables, constraints etc. (Schema).
Data Adapters
  • A Data Adapter provides a bridge between a disconnected data set and its data source
  • Its role is to serve as a pipe between relational database objects (such as tables in an Access database) and a DataSet object.
  • Each .NET data provider provides its own implementation of the interface IDbDataAdater.
  • The OleDbDataAdapter, and the SQL data provider has the class SqlDataAdapter
  • A Data Adapter has the properties for SelectCommand, InsertCommand, UpdateCommand and DeleteCommand.
  • These properties identify the SQL needed to retrieve, add, change, or remove data from the data source

A Data Adapter has the Fill method to place data into a data set. It has the Update command to update the data source using data from the data set.


If you want to get access to the data in a table then

  • Create a connection to the database in which the table is stored
  • Then create an adapter with the SQL to retrieve that table
  • Then fill the DataSet object using that adapter
  • Note: Data adapters can handle only one SQL query at a time, but DataSet objects can store multiple tables, and to place multiple tables in a Dataset you can use multiple data adapter

So the three objects that are essential to know about are- data connection to connect to the database, data adapters to execute SQL with, and datasets to store the data as returned from adapters-that your code will actually work on

Creating the Data Set manually
  • Although it is common to populate a data set from a database, you can also create a data set programmatically. You can then use this data set as a temporary store for program data, enjoying the full relational capabilities of a data set
Using XML Data
  • XML is becoming standard for transmitting data on the Internet.
  • This is also a data storage language which is portable
  • It is similar to HTML in that it is based on tags
  • However, unlike HTML, it’s tags are not predefined
  • It is capable of representing a self describing collection of data.
  • Because the data is text-based, it can be passed through firewalls and does not require the use of protocols such as DCOM
  • The capability to represent datasets natively as XML documents is important. This is because XML can pass through corporate firewalls, while COM objects such as ADO recordsets cannot pass through firewalls without special settings, which can expose a network to security breaches.
  • ADO.NET uses XML internally to manage the data in a DataSet object
  • The DataSet class has methods that can be used to read and write XML schema and data information
  • An XML document may describe schema information as well as contain data
  • XML schemas are written in XML
  • XML can be used to describe both the tables and columns in a relational database

Connection<< Previous


Our aim is to provide information to the knowledge seekers. 

comments powered by Disqus