Database Connectivity: Com Based Model Name Space Model
Database Connectivity: Com Based Model Name Space Model
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
This is available in
client system
Data Adapter Connection
Data Providers
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
Insert Command
Update Command
Update(Dataset Name[,DataMember])
Delete Command
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
db
Select Command
Fill(ds,”emp”)
DS
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
db
Update(ds,”emp”)
DS
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
DATA VIEW UI
UI
Used if the data has to be filtered,
sorted or if the data has to be projected
in page-wise