N342 Home Work 1
|
Modified: |
Downloads
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.
Implement HTML, Access database and ASP to do the following:
- HW1.HTM
- Displays your name as author,
- Displays a form containing text input for a name,
- When form submitted, executes Faces.ASP with the text input for name at the end of the address.
- Faces.ASP
- Searches the database for a name,
- If name found, displays the corresponding photo and name, clicking the photo should open an email client to send the person mail,
- If name not found, displays all the photos and corresponding name, clicking the photo should open an email client to send the person mail,
- Displays a form containing text input for a name and the action='Faces.ASP'; this will allow repeated searches.
- Faces.mdb
- Database for name, email and file name containing photo image,
- If using Access 2007, save the database as an Access 2003 database,
- Define 3 fields, name, email and photo,
- 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.
- 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.
- 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.
- 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.
- 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
- 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/>
- 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.
- Modify Faces.ASP to display all names, emails and corresponding photos from the database table.
- Write and test in Access a SQL query to select the record in which the name is matched.
- 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
- <a href='mailto:obama@whitehouse.gov'>President</a> is HTML for sending email via a text link.
- <a href='mailto:obama@whitehouse.gov'><img src='obama.jpg'/></a> is HTML for sending email via an image link.
- SELECT performs exact matches with =
SELECT * FROM HW1 WHERE Name = 'Wisman, Raymond F.'
- SELECT performs partial matches with LIKE
SELECT * FROM HW1 WHERE Name LIKE '%Ray%'
Likely problems and solutions are:
- 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"
- Refresh the browser - Remember the browser caches the output which may be stale.
- View the source - Executing the ASP should generate HTML for the browser. To see the HTML the browser sees, view the page source.
- 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' )+"'");
- Errors related to OPEN of database - In Access, open the Faces.mdb database, select Tools. Database Utilities..., Compact and Repair Database.
- Could not find file (unknown) - For error message below, verify that the Access database file spelling matches that in the ASP and file directory.
error '80004005'Microsoft OLE DB Provider for ODBC Drivers
[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
Turn in - Due before class on the date listed in the syllabus.
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.