You are on page 1of 16

DATABASE CONNECTIVITY

IN .NET
ADO
COM BASED MODEL

ADO.NET
NAME SPACE MODEL

ADO.NET
CONNECTION ORIENTED MODEL
DISCONNECTED ORIENTED MODEL

CONNECTION ORIENTED
MODEL
Whenever an application uses the
connection oriented model to interact with
the db then the connectivity between the
application and the database has to be
maintained always.

Connection Oriented
Application

db
DATA PROVIDERS
Data Reader

Command

Connection

Whenever an user executes any statement other


than a select then command object can be binded
directly to the application
If the user executes a select statement then
dataReader is used to bind the result to the
application.

Disconnected Oriented Model in


ADO.net
When the user interacting with the db using
this model then while performing the
manipulations or navigations on the data
connectivity between the application and the
database is not required
Note: When ever the data is been updated on to
the database then the connectivity is required
in the disconnected model.

DISCONNECTED MODEL
Application

DataSet

Data View

This is available in
client system

Data Adapter

Connection

Data Providers

Database

Disconnected Model
Connection it is used to establish the physical
connection between the application and the database
DataAdapter it is a collection of commands which acts
like a bridge between the datastore and the dataset.
Commands in DataAdapter
DataAdapter
Select Command
Table Mappings

Collection of all these commands


is DataAdapter
Fill(Dataset Name[,DataMember])

Insert Command
Update Command
Delete Command

Update(Dataset Name[,DataMember])

Points to remember about


DataAdapter
DataAdapter can always be binded to a single
table at a time.
Whenever the dataAdapter is used then implicit
opening and closing of connection of closing
object will take place.
If the dataAdapter is defined using a tool or a
control then all the commands for the adapter
will be defined implicitly provided the base
table with a primary key.
If the base table is not defined with a primary
key then the commands relevant for update
command and Delete command will not be
defined.

Fill Method
It is used to fill the data retrieved by the select
command of DataAdapter to the dataset.
Data Adapter
Select Command
Select * from emp

Fill(ds,emp)
DS

db

Update Method
It is used to update the dataAdapter with the
data present in the dataMember of the dataSet.
In other words used to the update the
database.
Data Adapter
Update(ds,emp)

DS

db

DataSet
It is an in memory representation of the data in the
format of XML at the client system.
Points to remember about DataSet:
It contains any no of datatables which may belong to the

same or different databases also.


If any manipulation are performed on the database it will
not be reflected on to the database.
Dataset is also considered as a collection of datatables
where a datatable can be considered as a DataMember.
Dataset will not be aware of from where the data is
coming from and where the data will be passed from it.
Dataset supports establishing the relationship between
the datatables present in the dataset where the datatables
might belong to different databases also.

Data Set
DataSet is of 2 types
Typed DataSet when ever the dataset is

defined with the support of XML schema


definitions then it is said to be typed dataSet.
UnTyped DataSet if the dataset is defined
without the XML Schema Definition then it is
said to be UnTyped DataSet.

DataView
It is logical representation of the data
present in the datamember of dataSet.
Usage It is used to sort the data,filter
the data or if the data has to be projected in
the pagewise then the dataView should be
used.

Command
It is used to provide the source for
executing the statement I.e it used to
specify the command to be executed.

Data Reader
It is a forward and read only record set
which maintains the data retrieved by the
select statement.

ADO.NET
DISCONNECTED MODEL

CONNECTION

CONNECTION ORIENTED MODEL

Used if the statement is


select statement

CONNECTION

DATA ADAPTER

COMMAND

DATA SET

DATA READER

DATA VIEW

UI

UI
Used if the data has to be filtered,
sorted or if the data has to be projected
in page-wise

You might also like