MIS 4372 -- Midterm Answers -- Fall 2016 -- Parks

  1. Problem 1 Execute
    Problem 1 Code

  2. Problem 2 Execute
    Problem 2 Code

  3. Rebuild database tables for Problem 1 Execute
    Code for database tables rebuild

Assume, there is a table structure as shown below.
Table name: tsales
salesperson_id int IDENTITY (1,1),
lname varchar(30) NOT NULL,
fname varchar(30) NOT NULL,
sales_region char(1) NOT NULL, [this field always contains 1,2,3 or 4 ONLY]
ytd_sales_p1 int, [these are the product sales for each of the companies 7 products]
ytd_sales_p2 int, 
ytd_sales_p3 int, 
ytd_sales_p4 int, 
ytd_sales_p5 int, 
ytd_sales_p6 int, 
ytd_sales_p7 int
This table holds the current product sales (products 1 thru 7) for each salesperson. You should NOT allow the user to modify: the salesperson_id, fname (first name), lname (last name) or sales_region
The table tsales is in a database named "gl001".
For a recordset, the credential string is: rs.open some_sql_string,"DSN=gl001;UID=gl001;PWD=11111;"
For a connection, the credential string is: cn.open "gl001","gl001","11111"
On all passes use:<form name="f1" action="http://auckland.bauer.uh.edu/sales_update.asp" method="post">

1. (50 points) Write the 1st and 2nd and 3rd passes for an salesperson update. Specifically:

  1. The first pass provides a textbox for specifying the salesperson_id
  2. The second pass provides the current information in the tsales table for the specified salesperson_id and allows the user to update the salesperson's product sales for each of the seven products. Provide:
  3. the third pass will update only the salesperson's data for the sales of the seven products

2. (50 points)

Create an asp program that shows product sales for all salespersons. Include all the columns in the database table tsales in the order shown at the top of the page (i.e., in the order they appear in the CREATE statement).

Order the report in ASCENDING sales_region order. Use the salesperson_id as the secondary sort parameter in ASCENDING order.

Additionally at the end of the report:

HINT: in *.asp to create a single dimensional array AND give initial values use:

some_array_name = Array(value,value, ... ,value)

or without initial values either of these:

some_array_name = Array()

or

some_array_name = Array(number_of_array_elements)

Two dimensional arrays can be define with:

DIM name_of_the_array ( number_of_rows , number_of_columns )