N342 Home Work 1
Server-side Basics

Modified

Downloads

Overview 

The assignment is for familiarization with the server-side programming basics used in building active Web information systems.

The result will be a simple information system you can use to contact others in our class.

The class overview discussion presented programming examples similar to those needed for the following assignment. 

View an example video of HW1.

Assignment

Implement HTML, Access database and ASP to do the following:

  1. HW1.HTM
    1. Displays your name as author,
    2. Displays a form containing text input for a name,
    3. When form submitted, executes Faces.ASP with the text input for name at the end of the address.
  2. Faces.ASP
    1. Searches the database for a name,
    2. If name found, displays the corresponding photo and name, clicking the photo should open an email client to send the person mail,
    3. If name not found, displays all the photos and corresponding name, clicking the photo should open an email client to send the person mail,
    4. Displays a form containing text input for a name and the action='Faces.ASP'; this will allow repeated searches.
  3. Faces.mdb
    1. Database for name, email and file name containing photo image,
    2. If using Access 2007, save the database as an Access 2003 database,
    3. Define 3 fields, name, email and photo,
    4. Enter data for name and email from the name and email on the photo file and photo as the full photo file name. For example, photo file named Ray.jpg would have name of Wisman, Raymond F. and photo of Ray.jpg.

Suggested Start

  1. The assignment uses photos and names of our class. We need names to match photos but you'll need to help by matching your own.
    • Click here to list class names and photos. This file should be ready the day following the first class.
    • Find yours and check the button that matches your name and photo.
    • Click the Match ME button.
       
  2. Download the class photos and extract to a directory named \N342. A subdirectory named HW1 will contain the photo files. Put all files in HW1 subdirectory. This file should be ready the day following the first class.
     
  3. Create the Faces.mdb Access database; the mdb extension will create the database compatible with Access 2003 drivers.
    • Click here to display the class names, emails and photos in semicolon separated fields that can then be:
      • copied and saved to a text file,
      • in Access, open the External Data tab and import the text file, note that the first line contains field names.
    • Write and test in Access a SQL query to select all records and all fields of the table.
       
  4. Write the HW1.HTM and verify that when the form is submitted the address contains the first name entered as text. Using the IUS server, open HW1.HTM by:
           
    www.ius.edu/username/N342/HW1/HW1.HTM

    When the form is submitted, the browser address should appear similar to below, assuming Ray was entered as text input:

    homepages.ius.edu/username/N342/HW1/Faces.ASP?name=Ray

     

  5. Write and test HTML, similar to the example below, using your class photo, name, and email to display a name with a clickable photo for sending email.
    <a href='mailto://george@whitehouse.gov'><img src='george.jpg'/></a><br/>George Bush<br/>

     

  6. Write Faces.ASP using Response.Write statements to output the previous HTML but with data coming from the Faces database. Display name, email and corresponding photo from the database table.
     
  7. Modify Faces.ASP to display all names, emails and corresponding photos from the database table.
     
  8. Write and test in Access a SQL query to select the record in which the name is matched.
     
  9. Add to Faces.ASP the SQL to select records by name and the logic to display the corresponding photo as a clickable image to send email when found or all the names and photos when not found. The logic is basically:
    rs = Search database table for Name record

    if !rs.EOF

        Write Name and clickable Photo

    else

        rs = Search database table for all records

        while !rs.EOF

            Write Name and clickable Photo

            Move to next record

Hints

  1. <a href='mailto:obama@whitehouse.gov'>President</a> is HTML for sending email via a text link.
     
  2. <a href='mailto:obama@whitehouse.gov'><img src='obama.jpg'/></a> is HTML for sending email via an image link.
     
  3. SELECT performs exact matches with =

    SELECT * FROM HW1 WHERE Name = 'Wisman, Raymond F.'
     

  4. SELECT performs partial matches with LIKE

    SELECT * FROM HW1 WHERE Name LIKE '%Ray%'

Problems

Likely problems and solutions are:

  1. When running your ASP, receive error message about "Site may be down, try again later." IE, by default, does not display errors from a Web server. Turn OFF friendly error messages by, in IE:

    Tools | Internet Options | Advanced | Browsing | Uncheck "Show friendly HTTP error messages"

     

  2. Refresh the browser - Remember the browser caches the output which may be stale.
     
  3. View the source - Executing the ASP should generate HTML for the browser. To see the HTML the browser sees, view the page source.
     
  4. SQL - Getting the " and ' right is difficult. For example:
    • conn.Execute("SELECT nickName FROM NameTable WHERE fullName='"+Request( 'fullName' )+"' ");

    When you get an execution error message, try writing it out to the browser by:

    • Response.Write("SELECT nickName FROM NameTable WHERE fullName='"+Request( 'fullName' )+"'");
       
  5. Errors related to OPEN of database - In Access, open the Faces.mdb database, select Tools. Database Utilities..., Compact and Repair Database.
     
  6. Could not find file (unknown) - For error message below, verify that the Access database file spelling matches that in the ASP and file directory.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.

Turn in - Due before class on the date listed in the syllabus.

  1. OnCourse Drop Box
    1. Compress the HW1 folder containing the homework files.
      • In Windows Explorer, right-click on the HW1 folder.
        • Send to
        • Compressed (zipped) Folder
        • HW1.zip will be created.
    2. Upload HW1.zip to your CSCI N342 OnCourse Drop Box using the Display Name of HW1.
       
  2. Web server
    1. Copy to W: drive
    2. Test by: http://iu-uits-eiwp1.ads.iu.edu/username/N342/HW1/HW1.HTM
    3. Email link to rwisman@ius.edu with subject: YOUR NAME - N342 HW1 - username

 

Using the Web server

Files stored on the course Web server (W: directory) are accessible to the WWW.

The file path W:\N341\index.htm on username RWISMAN directory can be accessed:

http://iu-uits-eiwp1.ads.iu.edu/RWISMAN/N341/index.htm

See W: Drive instructions.