Classes
for communicating with database
The
Connection,
Command,
DataReader,
and DataAdapter
objects
are the core elements of the ADO.NET provider model.
Object
|
Description
|
SqlClient
Objects
|
OleDb
Objects
|
Connection
|
Establishes
a connection to a specific data source.
|
SqlConnection
|
OleDbConnection
|
Command
|
Executes
a command against a data source.
|
SqlCommand
|
OleDbCommand
|
DataReader
|
Reads
a forward-only, read-only stream of data from a data source.
|
SqlDataReader
|
OleDbDataReader
|
DataAdapter
|
Populates
a DataSet and
resolves updates with the data source.
|
SqlDataAdapter
|
OleDbDataAdapter
|
Each
provider may have classes equivalent to above objects. The name of
the classes vary slightly
to represent the provider type appropriately.
Depending
on the type of database you work on, you will have to choose either
OleDb or SqlClient
(or, some other provider) objects. Since all our samples use MS
Access database, we will
be using OleDb objects in all the samples. If you like to use
SqlServer, you just need to replace
the OleDb objects with the equivalent SqlClient objects.
No comments:
Post a Comment