0% found this document useful (0 votes)
16 views

Architecture in

Uploaded by

Tesfahun Maru
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Architecture in

Uploaded by

Tesfahun Maru
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

VB.

NET
ADO.NET Architecture

Kavita K. Bharti
Assistant Professor
Computer Department
Durga Mahavidyalaya, Raipur
Overview
• Stands for Active Data Objects.
• It is a technology which is used to establish
connection between .NET application and data
sources.
• It is used to access the database.
• All ADO.NET classes are into System.Data.dll.
Following figure shows communication between .NET application and database

ADO.NET

.NET Application Datebase


(Front End)
The Architecture of ADO.NET
• The ADO.NET Architecture is comprised of
following important components:
• Connection
• Command
• DataReader
• DataAdapter
• DataSet
VB.NET C# J# VC++

Front End

DataSet

DataAdapter

Command DataReader

Connection

Ado.net

Structure of ADO.NET
Connection
• It is an important component of ADO.NET Architecture .
• It is used to establish connection.
• It is essential to connect with your backend database.
• Backend database can be SQL Server, Oracle, MySQL, etc.
• To create a connection object, we need at least two things. The first one is
the physical address of your database. And the second thing is the
security credentials i.e. user name and password
• The first is to create the connection object and the connection object is
required to connect the front-end application with the backend data
source.
• A connection string is a string of parameters that contains the necessary
details for establishing a connection with the data source. It includes
information such as the data source location (e.g., server name or file
path), credentials (e.g., username and password), and any other required
settings specific to the data source.
Command
• It is used to execute a SQL query.
• It serves as the bridge between the application and the data source,
allowing developers to interact with the data by issuing SQL queries or
executing stored procedures.
• To execute SQL statements or stored procedures, the Command Object
provides a range of Execute methods.
• The Execute methods offered by the Command Object allow for
various execution scenarios.
• They can be used to retrieve results from the data source, modify data
within the data source, or execute non-query commands that do not
return any data.
• The choice of the appropriate Execute method depends on the type of
SQL command being executed and the expected outcome.
DataReader
• It is used to read the resultset.
• It provides stream-based, forward-only mechanism for retrieving
query results from the data source.
• the DataReader is specifically designed for read-only operations and
does not support data modification.
• It reads the data row by row, allowing the application to process and
consume the data in a sequential fashion.
• the DataReader is optimized for performance and memory efficiency.
• It efficiently streams data from the data source as it is being read,
eliminating the need to load the entire result set into memory.
• This makes it highly suitable for working with large datasets where
memory consumption is a concern.
Data Adapter
• It populates the Dataset Object with results retrieved from a data source.
• It acts as a bridge between disconnected Dataset objects and the physical data
source.
• When working with ADO.NET, the Dataset Object serves as an in-memory
representation of data retrieved from a data source.
• To initially populate the Dataset Object with data, the DataAdapter Object
comes into play.
• It handles the communication and data retrieval process, utilizing the
appropriate Connection Object to establish a connection with the data source.
• Once the connection is established, the DataAdapter executes the necessary
SQL statements or stored procedures and retrieves the corresponding data.
• It populates the Dataset's tables, rows, and columns with the retrieved data,
ensuring that the in-memory representation aligns with the data structure
from the data source.
DataSet
• It provides the disconnected representation of
results from the data source.
• The DataSet is entirely independent from the data
source.
• It is a Disconnected record set that can be browsed
in both i.e. forward and backward mode.
• It is not read-only i.e. you can update the data
present in the data set.
• DataSet is a collection of DataTables that holds the
data and we can add, update, and delete data in a
data table.
• DataSet gets filled by DataAdapter.
• Within the DataSet, data is organized into
rows and columns, similar to a traditional
database table.
• It also supports defining primary keys,
constraints, and relationships between
DataTable objects.
Structure of DataSet
Advantages of ADO.Net over ADO
• There are some similarities and differences between ADO and
ADO.NET.

• ADO, being an older technology, relies on COM (Component


Object Model) for its implementation. On the other hand,
ADO.NET is built on top of the .NET Common Language Runtime
and utilizes managed providers defined within the .NET
framework.

• One similarity between ADO and ADO.NET is the need for a


connection to a data store in order to fetch data. Both models
require establishing a connection to the data source, and the
code for establishing a connection is similar in many cases.

You might also like