june 23, 2001database creation review and exercises1 building an application - part i -

22
June 23, 2001 Database Creation Review and Exercises 1 Building an Application - Part I -

Upload: janel-long

Post on 17-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 1

Building an Application- Part I -

Page 2: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 2

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 projectx.dbProject's

Home Page

report.asp

Project'sDatabase

Report

Page 3: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 3

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")

Page 4: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 4

Personal Web Server (PWS)

"C" Drive

Inetpub

wwwroot

YourProject

• Default directory for PWS Download• Install using "setup.exe"

• Top folder for installed PWS files

• Root for your personal web site• URL is http://localhost

• Place your application files here• You can create subbordinate directories• URL for files in here: "/yourproject/yourfilename"

PWSSetupFiles

Page 5: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 5

Tailoring Your PWS

• Right click on PWS icon (at bottom of screen)

• Click on "Properties"

• PWS "Main" window appears

Page 6: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 6

PWS Main Window

Select "Advanced" from the "View" pulldown meny

Page 7: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 7

Advanced Options

Select default document

Set default document to "default.asp"

Allow directory browsing

Page 8: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 8

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"

Page 9: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 9

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 !!!

Page 10: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 10

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

Page 11: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 11

Invoking a DOS Window

Page 12: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 12

asdf

Page 13: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 13

Invoking DOS Edit

Go to your project directory

Enter the "edit" command

Page 14: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 14

Open Your ASP File

This window popped up as a result of selecting "open" under the File Pulldown Menu

This causes all "asp" programs to be listed.You can change this to anything you want.

Page 15: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 15

Editing Your File

Line number and column number of cursor

Page 16: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 16

Saving Your Edits

Select the "Save' Option

Page 17: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 17

Your Specific ProblemProblem 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

Page 18: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 18

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 = yellowleft margin = 20%right margin:20%top border width = 10ptbottom border width = 10ptright border width = 5ptleft border width = 5ptborder style = outsetborder color = blue;top padding = 10ptbottom padding = 10ptfont family = verdana, arial;right padding = 20ptleft padding = 20pt

Page 19: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 19

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

Page 20: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 20

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.

Page 21: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 21

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.

Page 22: June 23, 2001Database Creation Review and Exercises1 Building an Application - Part I -

June 23, 2001 Database Creation Review and Exercises 22

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