Professional Documents
Culture Documents
NET
Objectives
In this lesson, you will learn to:
☛Identify the need for ADO.NET
☛Identify the features of ADO.NET
☛Identify the components of the ADO.NET object model
☛Connect to a database by creating a data adapter
☛Access a database through a dataset
☛Preview the data adapter result
ADO.NET
☛ Is a model used by Visual Basic .NET applications to
communicate with a database for retrieving, accessing, and
updating data.
☛ Uses a structured process flow to interact with a database.
Features of ADO.NET
☛ Disconnected data architecture — Applications connect to
the database only while retrieving and updating data.
☛ Data cached in datasets — ADO.NET is based on a
disconnected data structure. Therefore, the data is retrieved
and stored in datasets.
☛ Data transfer in XML format — ADO.NET uses XML for
transferring information from a database into a dataset and
from the dataset to another component.
☛ Interaction with the database is done through data
commands.
Just a Minute…
List the features of ADO.NET.
DATA PROVIDER
Establishes
connection with
the database
CONNECTION
Retrieves data in a
VISUAL BASIC Accessing read-only,
.NET retrieved data forward only mode
APPLICATION DATA READER
(WINDOWS/ Executes a
WEB FORM) command to retrieve
data from the DATABASE
COMMAND database
Just a Minute…
Identify the two types of data providers and list the difference
between them.
➤ Close()method
➤ State property
➤ OleDbDataAdapter
Just a Minute…
What is the function of a data adapter?
➤ Close()
➤ NextResult()
Dataset
☛Is a disconnected, cached set of records that are retrieved
from a database.
☛Is present as a DataSet class in the System.Data
namespace.
☛Has its own object model.
DATASET
DataRelation DataTable
DataRow DataColumn
Just a Minute…
What are the various components of a dataset?
Task List
☛Identify the data that needs to be displayed.
☛Identify the method for creating a data adapter.
☛Identify the type of dataset to be created.
☛Create a data adapter.
☛Create a dataset.
☛Preview the database records.
Just a Minute…
What are the different methods of creating a data adapter?
Just a Minute…
What is the difference between typed and untyped dataset?
Summary
In this lesson, you learned that:
☛ADO.NET is a data access programming model for
accessing the data stored in a database from a .NET
application.
☛ADO.NET has the following features:
✓ A disconnected data architecture
✓ Data cached in datasets
✓ The use of XML format for data transfer
✓ Database operations done through data commands
Summary (Contd.)
☛ ADO.NET consists of the following components:
✓ Data Provider — Used for connecting to a database,
retrieving data, storing the data in a dataset, and
updating the database.
✓ Data Adapter — A data adapter is integral to the
working of the ADO.NET model since data transfer to
and from the database is done through a data adapter.
✓ Dataset — A dataset is a disconnected cached set of
records that are retrieved from the database.
☛ A data adapter communicates with a database through data
commands. These data commands use parameters for
execution.
©NIIT Working with ADO.NET/Lesson 5/Slide 28 of 30
Working with ADO.NET
Summary (Contd.)
☛After a dataset has been created, a data adapter uses the
process of table mapping to map the columns in the
database table with the dataset columns.
☛A data adapter can be created by using any of the following
methods:
✓ Manually
✓ Through a wizard
✓ By using Server Explorer
Summary (Contd.)
☛Datasets are of two types:
✓ Typed datasets – A typed dataset is derived from the
DataSet class and has an associated schema.
✓ Untyped datasets – An untyped dataset does not have
any associated XML schema. The tables and columns
in an untyped dataset are represented as collections.