Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

ADO.

NET provides the following set of classes for


accessing and manipulating data:

1. Connected classes
2. Disconnected classes

Disconnected classes are the classes which can be used


without actually connecting to a data store. These
classes can be created from data stored inside a database
or another data store. Once created, they can be
disconnected from the underlying data store that was
used to create them.

Disconnected classes are contained in System.Data and


System.Data.Common namespace.

Disconnected classes:

 DataSet
 DataTable
 DataRow
 DataColumn
 DataConstraint

DataSet-DataSet object is designed for disconnected use


and can contain a set of DataTable and include
relationships between the tables. The data stored in
DataSet is a disconnected copy of the actual Database.
DataSet is designed for data access independent of any
data source. Any changes you make to dataset exists only
on RAM

DataTable - A container of the data that consists of one


or more DataColumns and when populated will have one
or more DataRows containing data. DataTable allows you
to examine the actual rows of Dataset through rows and
columns collections. Once DataSet is filled, the database
connection is released and operates disconnected only.

DataColumn - This object contains the definition of a


column, such as name and datatype.This object is just a
metadata storage class about the column, its constraints,
types etc.

DataRow - Each row in a DataTable is represented in the


rows collection as a DataRow class. DataRow class is
where you perform update to a DataSet.

DataRelation - A link between 2 DataTable classes


within a DataSet class. Mapping between tables is
handled using DataRelation class.
Constraint - This class defines a rule for a DataColumn
class. Constraint objects are maintained through the
DataTables constraint collection.

Connected classes :

Connected classes in ADO.NET are designed to


communicate directly with the data source. Connected
classes are database specific classes. These classes
implements a set of standard interfaces defined within the
System.Data namespace.

These classes are used to transfer data between data store


and the client application. These classes provide the
bridge between the disconnected classes and a particular
data store.

Connected classes:

 DbConnection
 DbCommand
 DbDataAdapter
 DbDataReader
 DbParameter
DbConnection - A dbConnection object is a
representation of the actual physical connection to the
database. We use this class to connect and disconnect
from the actual database. The DbConnection is an abstract
class from which provider-specific connection class
inherits. Object of Connection also acts as a handle to the
database for other objects.

DbCommand - DbCommand object is used to send one


or more structured query language(SQL) statements to the
database. DbCommand class represents a query or
question against a database. The DbCommand object
requires a valid open connection to issue the command to
the data store. A DbConnection object can be passed into
the DbCommand object’s constructor or attached to the
DbCommand object’s Connection property.

DbDataAdapter - DbDataAdapter object is used to


retrieve and update data between DataTable and a data
store. The DbDataAdapter is derived from the
DataAdapter class and is the base class of the provider
specific DbDataAdpater class. The DbDataAdapter has
SelectCommand,InsertCommand,UpdateCommand and
DeleteCommand properties. The Fill() method of
DbDataAdapter provided an efficient mechanism to fetch
the results of a query into DataSet or DataTable.

DbDataReader - A DbDataReader object provides a high


performance method of retrieving data from a datastore.It
is built as a way to retrieve and examine the rows returned
in response to your query as quickly as possible.

You might also like