Contents
Overview 1
Introducing Data-Driven Web Sites 2
Demonstration: Tour of the Sample Web
Site 8
Retrieving Data from a Database 10
Lab 1.1: Retrieving Data from a Database 22
Demonstration: Creating a Detail Results
Page 28
Lab 1.2: Creating a Detail Results Page 30
Review 34
Module 1: Displaying
Data from a Database Information in this document is subject to change without notice. The names of companies,
products, people, characters, and/or data mentioned herein are fictitious and are in no way intended
to represent any real individual, company, product, or event, unless otherwise noted. Complying
with all applicable copyright laws is the responsibility of the user. No part of this document may
be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of Microsoft Corporation. If, however, your only
means of access is electronic, permission to print one copy is hereby granted.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual
Production Support: Susie Bayers (Online Training Solutions, Inc.)
Test Manager: Sid Benavente
Courseware Testing: Eric Myers
Creative Director, Media/Sim Services: David Mahlmann
Web Development Lead: Lisa Pease
CD Build Specialist: Jenny Boe
Online Support: Debbi Conger
Manufacturing Manager: Rick Terek
Operations Coordinator: John Williams
Manufacturing Support: Laura King; Kathy Hershey
Lead Product Manager, Release Management: Bo Galford
Lead Product Manager, Internet Services: Hilary Vandal
Group Manager, Courseware Infrastructure: David Bramble
Group Product Manager, Content Development: David Bramble
General Manager: Robert Stewart
Module 1: Displaying Data from a Database iii Instructor Notes
The module takes students on a tour to a sample intranet site and introduces a
case study of a fictitious company. The module introduces the components of
Web site architecture and database architecture. This module also teaches
students the procedure for retrieving records from a database by importing the
database to the current Web and establishing a connection with a database by
using the Database Results Wizard. The procedure for displaying data from a
database by specifying the rows and fields to be displayed, and selecting the
formatting options for database results are also covered. Finally, the module
teaches students how to create a detail results page.
After completing this module, students will be able to:
Read all the material for this module.
!
Complete the lab.
Presentation:
65 Minutes
Labs:
55 Minutes
iv Module 1: Displaying Data from a Database Module Strategy
Use the following strategy to present this module:
Start the module with an introduction of data-driven Web sites. Show them
some real examples of data driven Web sites. After the introductory topics are
over, take them through the sample site and tell them that they will create the
Personal Data part of the intranet site.
Demonstrate the procedures using the Database Results Wizard, while
explaining each option and telling them under what situation they would be
using each option. It is very important to tell them real examples of why they
would create a particular page.
Module 1: Displaying Data from a Database 1 #
##
#
Overview
!
Describe the database architecture.
!
Retrieve records from a database.
!
Specify the data to be displayed.
!
Create a detail results page. Slide Objective
To provide an overview of
the module topics and
objectives.
Lead-in
In this module, you will learn
about dynamic Web sites
and how to display results
from a database by
establishing a database
connection.
2 Module 1: Displaying Data from a Database #
##
#
Introducing Data-Driven Web Sites
!
Lead-in
In this module, you will
identify the need for a data-
driven Web site. You will
also identify the components
of Web site architecture and
database architecture.
Module 1: Displaying Data from a Database 3 Components of a Data-Driven Web Site The architecture of a data-driven Web site consists of three major components,
Web browser, Web server, and database.
Web browser
The Web browser is an Internet client program that uses hypertext transfer
protocol (HTTP) to make requests of Web servers on behalf of the user.
Web server
The Web server is a program that uses the client/server model and HTTP to
generate the files that form Web pages for users. The Web server is responsible
for managing and delivering the content that you wish to make available over
the Web. The Web server takes a large repository of information from a
database and makes it easily available to users. Some of the common Web
server software includes Microsoft IIS, Microsoft Personal Web Server, and
Apache.
Database
Every organization maintains data pertaining to its business, employees, and
finances. This data needs to be accessed, maintained, and updated on a regular
basis. Data is stored in a database in the form of tables. A database is a
Consider an example of a table named Student that contains information about
students in a batch along with their grades for each semester. Student data, such
as student name and student ID, is repeated each time that the grades for
students are recorded in different semesters. This results in data redundancy.
Additionally, if the value in one field is to be updated, the same value has to be
updated in multiple rows for that student. Otherwise, it would lead to data
inconsistency across rows.
To reduce redundancy and eliminate inconsistency in a table, you can break a
complex table into simple and related tables. For example, you can break down
the Student table and store student data, such as names and addresses in a table
called Student Details and the grades in another table called Performance.
When a database has related tables, it means that two or more tables contain one
or more fields that are related to each other by one or more common fields. For
example, each record in the Student Details table has a StudentID field that is
related to the StudentID field in the Performance table.
Slide Objective
To provide an overview of
database architecture.
Lead-in
A database is a collection of
data that you can sort,
search, add to, edit, and
print when required.
6 Module 1: Displaying Data from a Database Interacting with Databases
!
To display records of all the employees in the Employee
table
In the preceding code, the SELECT statement displays all the records in the
Employee table, because the asterisk (*) indicates all records.
Updating records in a table
Consider a situation where an employee, Anne Austin, changes her telephone
number. In this situation, you have to update a field in a record of the Employee
table. For this, you will use the UPDATE statement as shown in the following
code:
UPDATE Employee
SET Phone="425-101-9000"
WHERE FirstName="Anne" AND LastName="Austin"
Slide Objective
To identify the queries used
to interact with database.
Lead-in
In order to retrieve
information from a relational
database, you use queries.
Module 1: Displaying Data from a Database 7 Deleting records from a table
Consider a situation where an employee, John Smith, resigns. His record should
be deleted from the Employee table. To do this, you use the DELETE
statement as shown in the following code:
DELETE Employee
WHERE FirstName="John"
AND LastName="Smith"
8 Module 1: Displaying Data from a Database
given employee.
Slide Objective
To introduce the
demonstration of the sample
intranet site for Fergusson
and Bardell Inc.
Lead-in
This demonstration takes
you on a tour of the sample
intranet site.
Delivery Tip
Demonstrate the features of
the sample site, and also
demonstrate the part that
they would be creating at
the end of the module.
Ask students to read the
questions in the student
workbook and identify
answers to the questions as
they watch the
demonstration.
After the demonstration,
review the questions and
their answers.
Module 1: Displaying Data from a Database 9
Important
10 Module 1: Displaying Data from a Database #
##
#
Retrieving Data from a Database
!
Demonstration: Importing a Database to the Current
Web
!
Demonstration: Connecting to a Database by Using
Database Results Wizard
!
Demonstration: Displaying Selective Records from a
Table
!
Demonstration: Setting the Sort Order and Limiting
Records
!
Demonstration: Displaying Data as a ListRetrieving data from a database involves the following steps:
1. Importing the database to the current Web.
2. Establishing a connection with the database.
3. Displaying data from the database.
Slide Objective
To demonstrate the
procedure for importing a
database to the current
Web.
Lead-in
To make a database readily
available to the current
Web, you import a database
to the current Web.
Delivery Tip
Demonstrate the procedure
for importing a database to
the current web.
Ask students to follow you
while you demonstrate the
steps.
12 Module 1: Displaying Data from a Database !
Import a database to the current Web:
1. Create a new one-page Web under http://localhost/1932/Democode/Myweb.
2. On the File menu, click Import.
The Import dialog box has the following buttons:
• Add File
Use this button to import a file, such as .mdb, .ppt, .xls, or .txt files to
the current Web.