<%@ Language=VBScript %> <% Response.Buffer = True %> <% // // PgP Distributed at Teaching with the internet seminar, WSU, 7/15/2003 // PgP 1/26/2003 This function prevents errors due to apostrophe in text field data strings // See Kauffman's Beginning ASP Databases, page 234 Function NoQuoteError(strField) NoQuoteError = Replace(Replace(strField, "'", "''"), CHR(34), """) End Function %> Homework List <% Dim objRS,objConn Dim PIN, cSQL Set objRS = Server.CreateObject("ADODB.Recordset") set objConn = Server.CreateObject("ADODB.Connection") // // *** WARNING! YOU MUST UPDATE THE PATH FOR YOUR DATABASE CONFIGURATION *** objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/USERNAME/studenthw") & "\" & "WebURLs.mdb" // gather data from input form elements PIN = cstr(request.form("txtPIN")) LastName = cstr(request.form("txtLastName")) cSQL = " SELECT tblHW.FirstName, tblHW.LastName, tblHW.Class, tblHW.Section, " & _ "tblHW.Assignment, tblHW.TimeTrack " & _ "FROM tblHW " & _ "WHERE tblHW.PIN=" & "'" & noquoteerror(PIN) & "'" & "AND " & "tblHW.LastName=" & "'" & noquoteerror(LastName) & "'" & " " & _ "ORDER BY tblHW.class, tblhw.assignment, tblhw.timetrack ;" // following is for trouble shooting // response.write("SQL: " & cSQL) // response.write("
PIN:" & PIN & "
") set objRS = objConn.Execute((cSQL),intRecordsAffected) if intRecordsAffected < 0 Then objRS.MoveFirst %>

Homework Listing

This is a list of your homework submissions.

> <% For each objField in objRS.Fields %> <% Next %> <% Do while Not objRS.EOF %> <% For Each objField in objRS.Fields %> <% Next objRS.MoveNext %> <% Loop %>
<%=objField.Name %>
<% If IsNull(objField) Then Response.Write(" " & " ") else Response.Write( objField.value ) End If %>
<% objRS.close set objRS = Nothing end if // Response.Write("

" & intRecordsAffected & " records affected!") Response.Write("

Return to Paulson's Course1 Homepage") %>