0% found this document useful (0 votes)
13 views9 pages

Introduction To ADO

ADO.NET is a data access technology within the .NET Framework that enables applications to connect to various data sources and manage data efficiently. It supports both connected and disconnected data access architectures, allowing for flexibility in how data is retrieved and manipulated. Key components include Connection, Command, DataReader, DataAdapter, DataSet, and various data providers like SqlClient and OleDb for different database interactions.

Uploaded by

sbk infotech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views9 pages

Introduction To ADO

ADO.NET is a data access technology within the .NET Framework that enables applications to connect to various data sources and manage data efficiently. It supports both connected and disconnected data access architectures, allowing for flexibility in how data is retrieved and manipulated. Key components include Connection, Command, DataReader, DataAdapter, DataSet, and various data providers like SqlClient and OleDb for different database interactions.

Uploaded by

sbk infotech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction to ADO.

NET

Prepared by,
M. Uvarani
ADO.NET
• The .NET Framework includes its own data access technology, i.e.,
ADO.NET. ADO.NET is the latest implementation of Microsoft’s
Universal Data Access strategy. It consists of managed classes that
allow .NET applications to connect to data sources such as Microsoft
SQL Server, Microsoft Access, Oracle, XML, etc., execute commands,
and manage disconnected data.
• ADO.NET was primarily developed to address two common ways of
working with data obtained from data sources:
• The first approach involves accessing data once and iterating through
it in a single instance, i.e., caching the data in runtime memory.
• The second approach involves working with data in a connected
manner, where data is not cached, and the application always
queries the database to retrieve it.
Features of ADO.NET
• Interoperability - XML documents are text-based formats, which means they can
be edited using standard text-editing tools. ADO.NET uses XML for all data
exchanges and for the internal representation of data.
• Maintainability - ADO.NET is designed with a separation between data logic and
the user interface. This allows developers to create applications in independent
layers, making them easier to maintain.
• Programmability (Typed Programming)- Typed programming is a style in which
specific user-defined types are used to construct statements or evaluate
expressions.
• Performance - ADO.NET uses a disconnected data architecture, which reduces the
load on the database and improves scalability. Since most operations are handled
on the client-side, overall performance is enhanced.
• Scalability - Scalability refers to the system’s ability to handle an increasing number
of clients without degrading performance. By using disconnected data access,
applications do not retain database connections for long durations. This approach
conserves resources and allows multiple users to access data simultaneously.
Components of ADO.NET

• Connection: The Connection component establishes a connection to a data source, such


as a database. It manages the underlying connection to the database server and provides
methods to open and close the connection.
• Command: The Command component represents a command that is executed against a
data source. It encapsulates SQL statements, stored procedure calls, and other database
commands. The two main types of command objects are SQLCommand, which is used for
executing SQL queries and stored procedures against SQL Server databases, and
OleDbCommand, which is Used for executing commands against OLE DB data sources,
which include various database types.
• DataReader: The DataReader component efficiently reads data from a data source. It
provides a forward-only, read-only stream of data that is particularly useful for retrieving
large datasets. Reading data with a DataReader is fast and memory-efficient.
• DataAdapter: The DataAdapter bridges the application’s DataSet (in-memory cache of
data) and the data source. It facilitates the retrieval of data from the data source into the
DataSet and also allows changes to be updated in the DataSet back to the data source.
Specific DataAdapter classes exist for different data sources, such as SqlDataAdapter and
OleDbDataAdapter.
• DataSet: The DataSet is an in-memory data cache that can hold multiple tables,
relationships, and constraints. It allows disconnected data manipulation, meaning that data
is retrieved from the data source, disconnected from the connection, and then
manipulated without direct interaction with the data source. The Data Set can be
considered an in-memory representation of the database.
• DataTable: A data table is a component within a Data Set that represents a table of data. It
consists of rows and columns and allows you to store and manipulate tabular data.
DataTables can have relationships and constraints to maintain data integrity.
• DataView: The DataView is used to filter, sort, and navigate through data within a
DataTable. It provides a dynamic view of the data, allowing you to customize how it is
presented to the user.
• Transaction: The Transaction component provides support for managing transactions in
ADO.NET. Transactions group multiple data access operations into a single unit of work that
can be either committed (made permanent) or rolled back (undone) as a whole.
• Connection String: The connection string is a configuration string that provides the
necessary information to connect to a data source. It includes details such as the database
server’s location, credentials, and other settings.
ADO.NET Data Providers
• The Database can not directly execute our C#
code; it only understands SQL. So, if a .NET
application needs to retrieve data or to do some
insert, update, and delete operations from or to
a database, then the .NET application needs to
• Connect to the Database
• Prepare an SQL Command
• Execute the Command
• Retrieve the results and display them in the
application
• common ADO.NET Data Providers include:
• SqlClient: This is the ADO.NET Data Provider for Microsoft SQL Server. It
provides optimized support for connecting to and interacting with SQL Server
databases. The System.Data.SqlClient namespace contains classes like
SqlConnection and SqlCommand.
• OleDb: The OleDb Data Provider allow us to connect to various data sources
using the OLE DB technology. It can be used to connect to different databases,
including Microsoft Access and other OLE DB-compatible data sources. The
System.Data.OleDb namespace contains classes like OleDbConnection and
OleDbCommand.
• Odbc: The Odbc Data Provider enables database connectivity using the ODBC
(Open Database Connectivity) API. It supports a wide range of databases
through ODBC drivers. The System.Data.Odbc namespace includes classes like
OdbcConnection and OdbcCommand.
• OracleClient: This Data Provider connects to Oracle databases.
Connected vs Disconnected Architecture in ADO.NET

• The ADO.NET is one of the Microsoft data


access technologies that is used to establish a
connection between the .NET Application
(Console, WCF, WPF, Windows, MVC, Web
Form, etc.) and different data sources such as
SQL Server, Oracle, MySQL, XML, etc. The
ADO.NET framework accesses data from data
sources in two ways: Connection-Oriented Data
Access and Disconnected-Oriented Data Access.
ADO.NET Connection-Oriented Data Access Architecture:

• In the case of Connection-Oriented Data Access Architecture, an


open and active connection is always required between the .NET
Application and the database.
• The Connection Oriented Data Access Architecture is forward
only.
• The Connection Oriented Data Access Architecture is read-only.
• For Connection Oriented Architecture, we generally use the
object of the ADO.NET DataReader class. The DataReader object
is used to retrieve the data from the database, and it also ensures
that an open and active connection is maintained while accessing
the data from the database. In Connection Oriented Architecture,
the .NET Application is directly linked with the corresponding
Database.

You might also like