Professional Documents
Culture Documents
net 1
An Introduction to ADO.NET
ADO.NET is an object-oriented set of libraries that allows you to interact with data
sources. Commonly, the data source is a database, but it could also be a text file, an Excel
spread sheet, or an XML file.
As you are probably aware, there are many different types of databases available. For
example, there is Microsoft SQL Server, Microsoft Access, Oracle, Borland Interbase, and
IBM DB2, just to name a few.
Features of ADO.NET
Some of the key features of ADO.NET are given bellow:
Connection with the original data source (Database) is closed. When the database needs to
be updated then the connection re-established.
Scalability
Any database operations (Such as INSERT/UPDATE/DELETE/SEARCH) are performed
on the dataset instead of on the database for this reason memory resources are saved.
Data Provider
Accessing
Retrieving
Data CONNECTION
Visual Basic
.NET
Application
(Windows DATA READER
/Web)
DATA BASE
Accessing Retrieving Data
COMMAND
DATASET
DATA ADAPTER
Filling
dataset
with Data
The information or Data are stored in the Database (SQL Server /Oracle/DB2 etc). The data
are being retrieving from the database using ADO. Net’s data Provider.
Note:
A .NET application can access data either through data set or through Data Reader
object.
Data Provider and Dataset these two are key components of ADO.NET.
Data Provider
A data provider is used for connecting to the database, retrieving data, storing the
data in a dataset, reading the retrieved data and updating the database.
There are main two types of data providers:
• OLEDB Data Provider---
This type of data provider works with all OLE DB providers, such as
SQL IOLE DB provider, Oracle OLE DB provider, and Jet OLE DB provider. The
OLE DB provider classes are present in the System.Data.OleDb namespace.
The various components of ADO. Net’s data providers are discussed bellow:
• Connection---
This component is used to establish the connection between the data
source with the .NET application (Window/ Web). Commonly used methods
and properties of Connection object these are
ConnectionString, State main properties
Open (), Close () main methods
• Data Adapter---
A data adapter is integral to the working of ADO.NET since data is
transferred to and from database through a Data Adapter. The data adapter
retrieve data from the database into dataset. When you make changes to the
dataset, and these changes in the database actually done by the Data
Adapter. Data adapter compares the data in the dataset then reflects the
changes in the original data source. Mainly two types of data adapters are
used in the. NET application
SqlDataAdapter and OleDbDataAdapter
• Data Command---
A data Command is an object representing a SQL statement or stored
procedure that is used to retrieve, insert, delete or modify data in a data
source. A data command is an object of the OleDbCommand or SQLCommand
class. A data command derived from the OleDbCommand class.
• Data Reader--
Data Reader is used to retrieve data from the database in a read-only
and frwd-only mode. A data reader uses the Connection object to connect to
the database, the Command object to execute SQL Statement or procedures
on the database and retrieves the data in a sequential mode.
SESSION: Variables are stored on the server, can hold any type of data including
references, they are similar to global variables in a windows application and use HTTP
cookies to store a key with which to locate user's session variables.
VIEWSTATE: Variables are stored in the browser (not as cookies) but in a hidden field in
the browser. Also Viewstate can hold only string data or serializable objects.
Hari K Reddy Asp.net 4
It says that it is a receiver and it receives the message from the provider.
An abstract class, in contrast, provides more structure. It usually defines some default
implementations and provides some tools useful for a full implementation. The catch is,
code using it must use your class as the base. That may be highly inconvenient if the other
programmers wanting to use your package have already developed their own class
hierarchy independently. In Java, a class can inherit from only one base class.