You are on page 1of 31

Introduction to

ADO.NET
and its Architecture

SRUSHTI NAIK – T19020


AMRIN SHAIKH – T19026
ADO.NET
Topics covered
• ADO.NET introduction
- Need
- Purpose
- Understanding Databases
- Configuring Database.
• Architecture
- Understanding the Data Provider Model
- Dataset Class
- Data table Class
- Data adapter Object
- Data reader Object
Objective

• What is ADO?
• What is ADO. NET ?
• Understanding Database and its configuration
• Architecture of ADO.NET
• SqlConnection, SqlCommand, DataReader class,
SqlDataAdapter, DataSet class
What is ADO?
ActiveX Data Objects (ADO) is an application program interface from Microsoft 
What is ADO.Net?
Ms Access
XML

SQL Server Oracle


.net Application ADO.Net

Web App Data


Console App Database
Windows App Provider
Data Source
Need of ADO.NET
Purpose of ADO.NET

Interacts Interacts
Our Program ADO.NET Database

• Consistent access to data sources such as SQL server and XML.


• Separates data access from data manipulation into discrete components.
• Provides functionality to developers.
• Provides the most direct method of data access within the .NET framework.
ADO.NET
OVERVIEW
EXAMPLE

Like a bridge which connects the two It is similar to the internet connection
ends, ADO.NET Connects application which allows communication
and database between two different ends
Understanding Database

• A collection of organized information on a


particular subject.
• It is organized so that queries and reports based
on the information can be readily performed.
• Common examples of databases:
 telephone book
 Student records.
Relational Database
EXAMPLE
• Represents the conceptual and
external schema as if that “data
view” were truly stored in one table.

• Although the conceptual view


appears to the user that this
information is in one big table, it
really is a set of tables that relate to
one another.
Basic Examples Of Data At Work In A Web Application

E-commerce sites Search engines Knowledge bases

Media sites
CONFIGURING
DATABASE
ADO.NET SQL Server Connection
1. Open Microsoft SQL Server Management Tool
2. Creating Database
ARCHITECTURE OF ADO.NET
The ADO.NET architecture has mainly two parts:
• Data Provider or Managed Provider (Connected Objects)
• DataSet (Disconnected objects)
1) .NET Framework data providers
The .NET Framework Data Providers are components that have been explicitly
designed for data manipulation and fast, forward-only, read-only access to data.
DATA Providers

NameSpaces
Data Providers Databases
SQLClient System.Data.SQLClient SQL Server
OracleClient System.Data.OracleClient Oracle
OleDb System.Data.OleDb Ms Access
Odbc System.Data.Odbc Configured
Database
DATA Providers

Data Providers Common classes


SQLClient Connection
OracleClient Command
OleDb DataReader
Odbc DataAdapter
DATA Providers

Data Providers Connection Class


SQLClient SQLConnection
OracleClient OracleConnection
OleDb OleDbConnection
Odbc OdbcConnection
A. Connection
B. Command
The Connection object provides connectivity to a
data source. The Command object enables access to
database commands to return data,
modify data, run stored procedures,
and send or retrieve parameter
information.
System.Data.SQLClient
System.Data.OracleClient
C. Data Reader
The DataReader provides a high- performance stream of data from the data source.
The DataReader Object is a forward-only, read-only retrieval of query results from the
Data Source, which do not update the data.
D. Data Adapter
It provides the bridge between the DataSet object and the data base.
2) The DataSet
• The ADO.NET DataSet is explicitly designed
for data access independent of any data
source.
• As a result, it can be used with multiple
and differing data sources, used with XML
data, or used to manage data local to the
application.
SqlConnection, SqlCommand, SqlDataReader And SqlDataAdapter
SqlConnection
It represents an open connection to a SQL Server database. This class cannot be inherited.
SqlConnection is used together with SqlDataAdapter and SqlCommand to increase
performance when connecting to a Microsoft SQL Server database.

SqlConnection object act as a mediator between data source and application which provides the means of
communication in between them.
SqlCommand class
• It represents a Transact- SQL statement or stored procedure to execute against a SQL
Server database. This class cannot be inherited.
• When an instance of SqlCommand is created, the read/write properties are set to
their initial values.
SqlDataReader class

• It provides a way of reading a forward-


only stream of rows from a SQL Server
database.
• This class cannot be inherited.
• To create a SqlDataReader, user must call
the ExecuteReader method of the
SqlCommand object, instead of directly
using a constructor.
SqlDataAdapter Class
• It represents a set of data commands and a database connection that are used
to fill the DataSet and update a SQL Server database.
• This class cannot be inherited.
DataSet Class
• Datasets are containers in which you can store data to use in your
application.
• The DataSet consists of a collection of DataTable objects
Data tables
• A DataTable stores data in a similar form to a database
table: data is stored in a set of fields (columns) and
records (rows).

• The DataTable class is a central class in the ADO.NET


architecture; it can be used independently, and in
DataSet objects.

• A DataTable consists of a Columns collection, a Rows


collection, and a Constraints collection.

You might also like