GST Billing Software

header image

Connected ADO.NET Architecture

Erachana Line

In C#, we work in two different ways with database connectivity. As you know when we create software or website or any other application which is connected to the database we need to make connection to the database to get data. Here you can get data in two different ways.

Either it can be connected architecture where you go and connect to the database and get data or disconnected architecture where you connect to the database first time and get all data in an object and use it if required. You can perform any action like insert, update, and search on this.

You can use two C# objects to achieve this, first one is DataSet and other one is DataReader.



It is a type of disconnected architecture. Disconnected architecture means, you don't need to connect always when you want to get data from the database. You can get data from dataset; basically, DataSet is a collection of data tables. We can store the database table, view data in the DataSet and can also store the xml value in dataset and get it if required.

To achieve this, you need to use DataAdapter which work as a mediator between Database and DataSet.


-It is a connected architecture, which means when you require data from the database you need to connect with database and fetch the data from there. You can use if you need updated data from the database in a faster manner. DataReader is Read/Forward only that means we can only get the data using this but we cannot update or insert the data into the database. It fetches the record one by one.


  • DataReader - A DataReader is an object that can be used to access the results sequentially from a database. The DataReader is used to get forward only sequential results as the query executes. This is used with the Command object (we will see the usage shortly).
  • Dataset - The Dataset can be thought of as an in-memory representation of a database. A DataSet is a disconnected data access object. The result of the query can be stored in a Dataset. The DataSet contains Data Tables. The DataTables contain DataRow and DataColumns. A DataSet or a DataTable can be used with a Command and a DataAdapter object to store query results.
  • DataAdapter - A DataAdapter object is used to fill a DataSet/DataTable with query results. This can be thought of as the adapter between the connected and disconnected data models. A Command object will be used to execute the query and a DataAdapter will use this Command object and fill the query results coming from the database into a DataSet/DataTable.



The first thing to notice in the application is that it contains a class that is responsible for all the ADO.NET logic. The class DataAccess (file: DataAccess.cs) contains all the ADO.NET classes and methods. All the pages use this class. This class can be reused in any application with some minor application specific changes. The class diagram for the class is: