Building an Application for the Goodbike Company
Download
Report
Transcript Building an Application for the Goodbike Company
Building an Application
- Part I -
June 23, 2001
Database Creation Review and Exercises
1
What You Were Asked to Do
• Build 5 generic web page components
–
–
–
–
1 person creates a css file for the project
1 person creates the Access database and populates it for test purposes (using the Acess GUI)
1 person creates the the default.asp file using procedures to create standard header and footer
1 person writes a function to open the database and a procedure for creating a recordset for
reporting
– 1 person writes a procedure for generating a report using all records and fields from the
recordset
• These components will be used in this application:
default.asp
Project's
Home
Page
report.asp
projectx.db
Project's
Database
Report
June 23, 2001
Database Creation Review and Exercises
2
Things You Need to Know
• Use Personal Web Server (PWS)
–
–
–
–
Directory structure
URL
PWS options
Creating a connection object
• Editing ASP files
• Finding adovbs.inc
(C:\Program Files\Common Files\System\ADO)
• Naming css files
(Must end in "htm" or "html")
June 23, 2001
Database Creation Review and Exercises
3
Personal Web Server (PWS)
"C" Drive
PWSSetupFiles
• Default directory for PWS Download
• Install using "setup.exe"
• Top folder for installed PWS files
Inetpub
wwwroot
• Root for your personal web site
• URL is http://localhost
YourProject
June 23, 2001
• Place your application files here
• You can create subbordinate directories
• URL for files in here: "/yourproject/yourfilename"
Database Creation Review and Exercises
4
Tailoring Your PWS
• Right click on PWS icon (at bottom of screen)
• Click on "Properties"
• PWS "Main" window appears
June 23, 2001
Database Creation Review and Exercises
5
PWS Main Window
Select "Advanced" from the "View" pulldown meny
June 23, 2001
Database Creation Review and Exercises
6
Advanced Options
Select default document
Set default document to
"default.asp"
Allow directory browsing
June 23, 2001
Database Creation Review and Exercises
7
Creating A Connection Object
•
Think of the connection object as your database
•
You need to:
– Create a connection object
– Set connections's properties
– Call open method with connection string
•
Different with each database and each server
•
Many times dependent on version of database
•
For Access on PWS (I hope):
dim oConnection 'Connection object
'Create connection object, define provider, open database
Set oConnection = server.createobject("ADODB.Connection")
oConnection.Provider="Microsoft.Jet.OLEDB.4.0"
oConnection.Open "c:\inetpub\wwwroot\db\goodbike.mdb"
June 23, 2001
Database Creation Review and Exercises
8
Editting an ASP File
• Typically cannot edit via a double click
• One method:
1) Select the file
2) Right click and select "Send To"
3) Select Notepad or Wordpad
• Another method:
1) Select the file
2) Shift right click and select "Open With" or "Send To"
3) Select Notepad or Wordpad
or better yet ...
• Use the DOS "Edit" command !!!
June 23, 2001
Database Creation Review and Exercises
9
DOS Edit Command
• Why DOS Edit?
• Allows you to easily find line number (and column number)
• In a nutshell:
1) Start Program --> MS-DOS Prompt
2) Go to your project directory via "cd" command
3) Enter the "Edit" Command
4) Open your ASP file
5) Edit your ASP file
6) Save your ASP file
• DOS Edit just another window
• Keep window open at all times
June 23, 2001
Database Creation Review and Exercises
10
Invoking a DOS Window
June 23, 2001
Database Creation Review and Exercises
11
asdf
June 23, 2001
Database Creation Review and Exercises
12
Invoking DOS Edit
Go to your
project directory
Enter the
"edit" command
June 23, 2001
Database Creation Review and Exercises
13
Open Your ASP File
This causes all "asp" programs to be listed.
You can change this to anything you want.
This window popped
up as a result of selecting
"open" under the
File Pulldown Menu
June 23, 2001
Database Creation Review and Exercises
14
Editing Your File
Line number and
column number of cursor
June 23, 2001
Database Creation Review and Exercises
15
Saving Your Edits
Select the "Save' Option
June 23, 2001
Database Creation Review and Exercises
16
Your Specific Problem
Problem Statement:
"Goodbike needs a Supplier Management system so that
they can track and report on their suppliers"
You need to:
• Modify your generic products to meet this specific requirement
-
The CSS file
The database design
The web page's headers and footers
The funciton for opening the database and procedure for creating a recordset
The procedure for generating a report
June 23, 2001
Database Creation Review and Exercises
17
The Style Requirements
Requirement 1: Insure that all paragraphs used throughout the
pages have the following characteristics. Note: include a paragraph
to prove that it works. (CSS):
background color = yellow
left margin = 20%
right margin:20%
top border width = 10pt
bottom border width = 10pt
right border width = 5pt
left border width = 5pt
border style = outset
border color = blue;
top padding = 10pt
bottom padding = 10pt
font family = verdana, arial;
right padding = 20pt
left padding = 20pt
June 23, 2001
Database Creation Review and Exercises
18
The Database Schema Requirement
Requirement 2: They must store the following information about their
suppliers (Database Table):
Supplier Number – Auto Generated Number
Name – 50 Characters
Address – 50 Characters
City – 50 Characters
State – 2 Characters
Zip – 9 Characters
Phone – 10 Characters
June 23, 2001
Database Creation Review and Exercises
19
Web Page Appearance Requirement
Requirement 3:
Create and use procedures that insure that the information at the top
and bottom of each page is the same. At a minimum, put the
company name at the top each page and a link back to the home
page at the bottom of each page.
June 23, 2001
Database Creation Review and Exercises
20
DB Open and Query Requirement
Requirement 4:
Create a function that opens the database and a procedure for
creating a recordset. The record set returned shall contain all records
in the supplier table.
June 23, 2001
Database Creation Review and Exercises
21
Reporting Requirement
Requirement 5: Allow the user to display a report which lists the
following information about suppliers.
Supplier Number
Supplier Name
Supplier City
Supplier State
June 23, 2001
Database Creation Review and Exercises
22