Download Chapter 13

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IMDb wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Concurrency control wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

PL/SQL wikipedia , lookup

Functional Database Model wikipedia , lookup

SQL wikipedia , lookup

Database wikipedia , lookup

ContactPoint wikipedia , lookup

Versant Object Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Chapter 13
Introduction to Data Access Classes and Persistence Using DBMS
Chapter Overview
After completing this chapter, you will be able to design a relational database and use the database to store and
retrieve object attributes of the DA class.
Chapter Objectives



Make objects persistent using a database
Explain how VB .NET creates and processes datasets
Use a relational database with VB .NET to add, update, delete and retrieve data
Key Terms














ADO .NET
data source name (DSN)
database
dataset
managed provider
object database connectivity (ODBC)
object persistence.
OleDb data provider
primary key
recordset
relational database
SQLClient
SQLServer data provider.
Structured Query Language (SQL)
1
Explanation of Symbols

Write a definition, concept or key point following the arrow.
______________
Fill in blank lines with a word or phrase to complete a definition, concept or key point.
choice1/choice2
Circle one of the choices.

The pointing finger comes into play when you review your notes. It is a prompt to
think of and write your own example(s) of a concept.
Using Relational Databases with VB .NET
Databases can be used to make objects persistent. A database is 
The data in a relational database is organized into tables that can be related to each other. Each table column
represents an ___________________ and each row represents a ________________________. The Structured
Query Language (SQL) is a standard set of keywords and statements used to access relational databases.
Relational databases are usually referred to as database management systems (DBMSs) because of all their query
and management features.
A relational database provides tools for organizing data into tables. In a DBMS, each column represents a field and
each row represents a record. A field used to uniquely identify a record is called a
___________________________.
Structured Query Language
Structured Query Language (SQL) is a popular, standardized language used to manage and query relational
databases.
A DA class performs four basic tasks:
(1) ______________________________________________________
(2) ______________________________________________________
(3) ______________________________________________________
(4) ______________________________________________________
These functions are implemented in the DA class using methods named ______________________,
_______________________, ____________________________, and __________________________.
2
The Find method uses the SQL ______________________ statement to retrieve a specific record from the database.
The syntax for a basic SQL statement to retrieve a particular record is 
The AddNew method uses the SQL ____________________ statement to add a new record to the database. The
syntax for this statement is 
The Update method employs the SQL ____________________________ statement to change the contents of one or
more fields in a record. The syntax for this SQL statement is 
The Delete method executes the SQL ___________________ statement, which specifies the key value of the record
to be deleted. The syntax for this SQL statement is 
Accessing a DBMS with VB .NET
VB .NET provides two basic options for accessing data: ADO (Active-X Data Objects) and ADO .NET. ADO
adheres to a more traditional client-server model that 
By contrast, ADO .NET works in a ____________________ mode, only connecting to the server when data is
needed from the data store or updates back to the data store are required. The ADO approach results in data being
kept and processed in a ____________________________, while ADO .NET relies on the concept of
________________________ as the basis for processing data.
3
VB .NET Database Access Classes
Originally, VB .NET has two managed providers (also referred to as .NET providers) for accessing data: the OleDb
data provider, designed for ________________________________________________________, and the
SQLServer data provider, designed for ____________________________________________________. The
namespaces for the two managed data providers for Microsoft Access and SQLServer are ___________________
and __________________________.
In addition to these managed data providers, __________________________________________ can be used to
access most other databases.
How VB.NET VB .NET Creates and Processes Datasets
A _______________________________ links data sources to data adapters. The data adapter contains instance
properties which correspond to the __________________________________ SQL commands. Each of these
commands requires the following properties to be set:
(1) ___________________________________________
(2) ___________________________________________
(3) ___________________________________________
VB.NET creates a _________________________________, which consists of row and columns that can be
processed like a relational database, regardless of _______________________________________.
To summarize, the OleDbDataAdapter serves as a bridge between a ___________________ and a
_______________________ for retrieving and saving data. The OleDbDataAdapter provides this bridge by using
the _________________________ method to load data from the data source into the
_________________________.
Connecting to a Database
4
There are two ways to connect to a data source: _________________________________________ or a DSN.
Using a DSN requires using an _________________ driver to 
Setting a connection string requires two segments:
(1) ___________________________________________
(2) ___________________________________________
Retrieving records from a database requires two steps:
(1) creating an OleDBDataAdapter object using an _________________________________ and the
___________________________
(2) Invoking the _______________________ method of the OleDbDataAdapter instance to populate the
DataSet
To add, update or delete a record from the database can be done in three steps:
(1) creating an _____________________________ object for the appropriate adapter command using an SQL
statement
(2) Setting the ___________________________ of the appropriate adapter command
(3) Invoking the ______________________________ method of the adapter command
Implementing Object Persistence with a Database
The previous examples of persistence—sequential files and object serialization—had the Initialize method read all
the customers and store their references into__________________________________ . When processing was
complete, the Terminate method wrote the customers back to a ____________________.
When a relational database is used, a different approach is needed. Here, the Initialize method establishes a
_______________________________________________________, the processing methods Find, AddNew,
5
Update, Delete, and GetAll ________________________________________, and the Terminate method closes the
_____________________________________to release system resources.
To access a relational database you must import the ________________________ and
__________________________ namespaces.
6