Ado.net is set of libraries that allow interacting with
database. There are many different types of data base available. For Ex,
Microsoft SQL Server, Microsoft Access, Oracle, Borland Interbase and IBM DB2.
ADO.Net
Flow:
ADO.NET Data Providers are class libraries that
allow a common way to interact with specific data sources.
Provider Name
|
API prefix
|
Data Source Description
|
ODBC Data Provider
|
Odbc
|
Data Sources with an ODBC interface. Normally older data bases.
|
OleDb Data Provider
|
OleDb
|
Data Sources that expose an OleDb interface, i.e. Access or
Excel.
|
Oracle Data Provider
|
Oracle
|
For Oracle Databases.
|
SQL Data Provider
|
Sql
|
For interacting with Microsoft SQL Server.
|
Borland Data Provider
|
Bdp
|
Generic access to many databases such as Interbase, SQL Server,
IBM DB2, and Oracle.
|
ADO.Net Objects:
Ado.Net
Provide many object to interact with data, I will explain some primary object
we will be use. The objects below are the ones you must know.
·
SqlConnection Object
·
SqlCommand Object
·
SqlDataReader Object
·
SqlDataAdapder Object
·
Dataset object
SqlConnection Object:
The connection object is helps to identify the database server,
the database 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 database to execute the command on.
SqlCommand Object:
The Command object to specified Action occur your database. You
can use Sql statement for a database. A command object uses connection object
figure out the specified connection or we can uses alone. The command object
can execute directly or assign reference to SqlAdapder.
SqlDataReader Object:
Some of operation
needs to get only a stream data for reading. The Data reader object allow to
obtain the result SELECT Statement to execute command object. For performance
reason. 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.
SqlDataAdapder object:
Some time we work with data primarily read-only and you rarely need to make changes. 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 database. A data adapter contains a reference to the connection object and
opens and closes the connection automatically when reading from or writing to
the database. Additionally, the data adapter contains command object references
for SELECT, INSERT, UPDATE, and DELETE operations on the data.
DataSet Object:
Dataset objects are
in-memory representations of data. They contain multiple Data table objects,
which contain columns and rows, just like normal database 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.