# ADO.Net Architecture | Data Providers | DataSet

> Source: https://msatechnosoft.in/blog/ado-net-architecture-data-provider-set/
> Published: 2017-04-20 · Updated: 2020-07-26
> Publisher: MSA Technosoft (https://msatechnosoft.in/)

## ADO.Net Architecture

**ADO.Net** is a data accessing technology of the **Microsoft .net** framework. It communicates with **DBMS** and **RDBMS** both through a common set of components. It acts as a bridge between **front-end control** and **back-end database**. Objects of **ado.net** are responsible for all data-related operations. **ADO.Ne**t perform its functions in both **Connected** and **Disconnected environments**.

According to Microsoft, ADO.NET is a set of classes that expose data access services for .NET Framework programmers. ADO.NET provides a rich set of components for creating distributed, data-sharing applications. It is an integral part of the .NET Framework, providing access to relational, [XML](https://msatechnosoft.in/blog/xml-xml-basics-xml-web-design-xml-tags-xml-reserved-symbols), and application data. ADO.NET supports a variety of development needs, including the creation of front-end database clients and middle-tier business objects used by applications, tools, languages, or[ Internet browsers](https://msatechnosoft.in/blog/web-browser-functions-of-web-browser).

## ADO.Net Components

**There are 2 main components of ADO.Net:**

- **Data Providers**
- **DataSet**

**System.Data** namespace contain all the classes of ado.net.

---

## Data Provider

**Data Provider** provides functionality to connect with databases. Data providers are used to performing operations on databases. **Ado.net** mainly work with 3 data providers in the .Net framework: **Microsoft SQL Server** data provider that uses **sSqlConnection**, an **OLEDB data provider** that uses **OleDbConnection**, an **ODBC** data provider that uses **OdbcConnection**.

A **Data Provider** contains objects of **Connection**, **Command**, **DataAdapter** and **DataReader** to perform the functionalities of the data provider.

- **Connection:** The object of Connection is used to establish a physical connection with the database. **Connection String** is used to providing necessary information for establishment of proper connection with the database.

Example:

> sqlConnection con= new sqlConnection();
> 
> con.ConnectionString= “DataSource=msa-technosoft-pc; initial catalogue= msa-technosoft-db; user id= user1; password= pass1”;
> 
> con.Open();

- **Command:** The object of Command is used to execute **SQL** operations on databases. Command object provides several execute methods to perform **SQL operations** in different ways.

Example:

> sqlCommand cmd= new sqlCommand(“insert into msa-tech-blog values(@slno, @title, @details)” ,con);
> 
> cmd.Parameters.AddWithValue(“@slno” , int.Parse(txtSlNo.Text));
> 
> cmd.Parameters.AddWithValue(“@title” , txtTitle.Text);
> 
> cmd.Parameters.AddWithValue(“@details” , txtDetails.Text);
> 
> cmd.ExecuteNonQuery();
> 
> con.Close();

- **DataReader:** This is an alternative of DataSet and DataAdapter. It is used in the connected environment. The object of DataReader allows direct access to the data records of databases.
- **DataAdapter:** It acts as a mediator between the database and DataSet object. It helps the DataSet to copy data from different data providers. It is useful in the disconnected environment.

---

## DataSet

The **dataset** is a subset of the database. It provides different mechanisms for data management in the disconnected environment. It is completely independent of the original data source. It is a copy of data source, but not having a physical connection with it. Reconnection is required to update the original database. It contains **DataRelation**, **DataTable collection**. The **DataTable Collection** is a collection of **DataTable**, **DataRow**, **DataColumn**, **attribute** and **data**.

- **DataRelation:** It is used to create a relation between two tables.
- **DataTable:** this class is used to represent the tables of the data source.
- **DataRow:** This object is used to represent a row of a table in Data Source.
- **DataColumn:** This is used to represent the column of a table in the data source.

Was this post helpful?

We would love to hear from you. Must share your views in the comment section below.

Visit [**Tech Blog**](https://msatechnosoft.in/blog) and get updated with all our informative technology blogs.
