Server-Side Web Programming with Active Server Pages
Lab 4 - Time Conversion Page / SQL Question 2

 

Part 1 - Time Conversion Page

Sample Solution

Since many ASP applications make heavy use of date math, in this lab you will create an ASP page that calculates the amount of time between the current date and a date selected by the client. The client will also select the units to return (e.g., months, days, weeks, years) and which weekdays (if any) to exclude from the calculation.

Create a directory called "Lab04" in your class child web with two pages: default.htm and output.asp. Below is a screen snapshot of the data entry elements--your default.htm page should include these, although you will want to arrange them in a more attractive and user-friendly page. Your output.asp page should provide the user with the date they selected, the current date, the calculation they requested, and a link back to the input page.

  • Your calculations for years and months are estimates, so you can assume all years have 365 days (ignore leap years) and that all months are 30 days.
  • Your results should be displayed to 1 decimal point.
  • Make sure your output page includes a link back to the input page.
  • Your page should handle inappropriate data entry in the day field (e.g., 32).
  • VBScript functions you will probably use include: INSTR, DATEDIFF, ISDATE, LEN, FORMATNUMBER
  • An easy test of your page is to select yesterday, or to exclude all days from the calculation, which should return a value of 0.
  • Make sure your input fields have default values as indicated below.

As always, follow page design best practices and make your user-interface clear and easy-to-use.

This lab is worth 15 points and due on September 30th.  When you have completed the lab, send an email to Chris Allen indicating you are done and providing the external URL to your pages.

Lab 4 Input Form

Part 2 - SQL SELECT and JOIN Statements

Create a page in your Lab04 directory called "SQL2.htm". Using the sample "Shop" database discussed in class, your page should list the questions below and provide a SQL statement (not the data) that would answer the question. 

1. Write a query to show the customer #, name information, and the sale date and ship date for all orders

2. Modify the previous query to only show rows with actual orders. Be sure to exclude voided customers and orders.

3. Show the count of the total number of products for each catalog and the catalog name.

4. For each order, write a query to summarize the sale by providing the total number of items, total price, and total sales tax.


Valtara Digital Design  http://www.valtara.com/csc123/   
Copyright 1999, 2001, Valtara Digital Design, Blitzkrieg Software