We know that ADO.NET allows us to interact with different types of data sources and different types of data bases.
A D V E R T I S E M E N T
However, there isn't a single set of classes that allow you to accomplish this universally. Since different data sources expose different protocols, we need a way to communicate with the right data source using the right protocol. Some older data sources use the ODBC protocol, many newer data sources use the OleDb protocol, and there are more data sources every day that allow you to communicate with them directly through .NET ADO.NET class libraries.
ADO.NET provides a relatively common way to interact with data sources, but comes in different sets of libraries for each way you can talk to a data source. These libraries are called Data Providers and are usually named for the protocol or data source type they allow you to interact with. table 1 lists some well known data providers, the API prefix they use, and the type of data source they allow you to interact with.
table 1. ADO.NET Data Providers are class libraries that allow a common way to interact with specific data sources or protocols. The library APIs have prefixes that indicate which provider they support.
Data Source Description
ODBC Data Provider
Data Sources with an ODBC interface. Normally older
OleDb Data Provider
Data Sources that expose an OleDb interface, i.e.
Access or Excel.
Oracle Data Provider
For Oracle Data Bases.
SQL Data Provider
For interacting with Microsoft SQL Server.
Borland Data Provider
Generic access to many data bases such as Interbase,
SQL Server, IBM DB2, and Oracle.
ADO.NET includes many objects you can use to work with data. This section introduces some of the primary objects you will use. Over the course of this tutorial, you'll be exposed to many more ADO.NET objects from the perspective of how they are used in a particular lesson. The objects below are the ones you must know. Learning about them will give you an idea of the types of things you can do with data when using ADO.NET.
The SqlConnection Object:
To interact with a data base, you must have a connection to it. The
connection helps identify the data base server, the data base name, user name,
password, and other parameters that are required for connecting to the data
base. A connection object is used by command objects so they will know which
data base to execute the command on.
The SqlCommand Object:
The process of interacting with a data base means that you must specify the
actions you want to occur. This is done with a command object. You use a
command object to send SQL statements to the data base. A command object uses a
connection object to figure out which data base to communicate with. You can
use a command object alone, to execute a command directly, or assign a reference
to a command object to an SqlDataAdapter, which holds a set of commands that
work on a group of data as described below.
The SqlDataReader Object:
Many data operations require that you only get a stream of data for reading.
The data reader object allows you to obtain the results of a SELECT statement
from a command object. For performance reasons, the data returned from a data
reader is a fast forward-only stream of data. This means that you can only pull
the data from the stream in a sequential manner. This is good for speed, but if
you need to manipulate data, then a DataSet is a better object to work with.
The DataSet Object:
DataSet objects are in-memory representations of data. They contain multiple
Datatable objects, which contain columns and rows, just like normal data base
tables. You can even define relations between tables to create parent-child
relationships. The DataSet is specifically designed to help manage data in
memory and to support disconnected operations on data, when such a scenario make
sense. The DataSet is an object that is used by all of the Data Providers,
which is why it does not have a Data Provider specific prefix.
The SqlDataAdapter Object:
Sometimes the data you work with is primarily read-only and you rarely need
to make changes to the underlying data source. Some situations also call for
caching data in memory to minimize the number of data base calls for data that
does not change. The data adapter makes it easy for you to accomplish these
things by helping to manage data in a disconnected mode. The data adapter fills
a DataSet object when reading the data and writes in a single batch when
persisting changes back to the data base. A data adapter contains a reference
to the connection object and opens and closes the connection automatically when
reading from or writing to the data base. Additionally, the data adapter
contains command object references for SELECT, INSERT, UPDATE, and DELETE
operations on the data. You will have a data adapter defined for each table in
a DataSet and it will take care of all communication with the data base for
you. All you need to do is tell the data adapter when to load from or write to
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
ADO.NET Data Providers, health insurance providers, high speed internet providers, health care providers, asp net data, ado net data provider, vb net data, dsl providers, wireless providers, medicare providers, internet providers, isp providers, cellular providers market data providers, medicaid providers.