Kroenke-DBP-e10-PPT-Chapter13
Download
Report
Transcript Kroenke-DBP-e10-PPT-Chapter13
David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Thirteen:
XML and ADO.NET
Part Four
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-1
ADO.NET
• ADO.NET is a new, improved, and greatly
expanded version of ADO that was developed
for the Microsoft .NET initiative.
• It incorporates all of the functionality of ADO and
OLE DB facilitates the transformation of XML
documents to and from database constructs.
• It uses datasets, which are in-memory, fullyfunctioned, independent databases.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-2
Role of ADO.NET
• ADO.NET serves as an intermediary between
all types of .NET applications and the DBMS
and database:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-3
Data Provider
• A .NET data provider is a library of classes that
provides ADO.NET services.
• Microsoft’s provides three data providers:
– OLE DB data provider can be used to process any
OLE DB-compliant data source.
– SQLClient data provider is purpose-built for use with
SQL Server.
– OracleClient data provider is purpose-built for use
with Oracle.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-4
Data Provider Components
• A connection object is similar to the OBDC’s
connection object.
• A command object is created on an established
connection.
• A data reader provides read-only, forward-only, fast
access to database data.
• An application can get and put data to and from the
database using the command object.
• A dataset is an in-memory database that is
disconnected from any regular database.
– It distinguishes ADO.NET from the previous data access
technology.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-5
Data Provider Components
(Continued)
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-6
The ADO.NET Dataset
• A dataset is an in-memory database that is
disconnected from any regular database.
• Datasets can have:
– Multiple tables, views, and relationships
• Tables may have surrogate key (auto increment columns),
primary keys, and be declared as unique.
– Referential integrity rules and actions
– The equivalent of triggers
• Datasets may be constructed from several
different databases and managed by different
DBMS products.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-7
Dataset Advantages
• Dataset contents and its XML schema can be easily
formatted as an XML document.
• Also, XML schema documents can be read to create the
structure of the dataset, and XML documents can be
read to fill the dataset.
• Datasets are needed to provide a standardized, nonproprietary means to process database views.
– This is important for the processing of views with multiple multivalue paths.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-8
Dataset Disadvantages
• Because dataset data are disconnected from regular
database, only optimistic locking can be used when
updating the regular database with the dataset.
• In the case of conflict, either the dataset must be
reprocessed or the data change must be forced onto the
database, causing the lost update problem.
• Thus, datasets cannot be used for applications in which
optimistic locking is problematical.
– Instead, the ADO.NET command object should be used.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-9
ADO.NET:
Creating the Dataset, Connection, and Data Adapter
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-10
ADO.NET:
Using the Data
Adapter to Fill the
Dataset Tables
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-11
ADO.NET:
Building Relationships
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-12
ADO.NET:
Creating
Referential
Integrity
Constraints
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-13
ADO.NET:
Adding a Computed Column to a Data Table
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-14
ADO.NET:
Using Data Grids
– Filling the Grids
with Dataset
Tables
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-15
ADO.NET:
Using Data Grids — Grid Display in Brower
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-16
David Kroenke’s
Database Processing
Fundamentals, Design, and Implementation
(10th Edition)
End of Presentation:
Chapter Thirteen Part Four
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-17