<% if request("action") = "add" then if request("subaction") = "" then'user is trying to complete blank form %>
 Instructor's Name
 Phone Number
 Instructor's Email

<% else 'ACTION=add and SUBACTION=complete SQL = "Insert into instructor_tbl (instructor_name , instructor_phone, instructor_email) Values ('" & cleanstring(request.form("iname")) &"','" & request("iphone") & "','" & request("iemail") & "');" SET CONN=server.createobject("ADODB.connection") Conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

You have successfully added an instructor to the database.

" end if' end of ADD action and ADD subaction else' request ACTION is = either modify or delete if request("subaction") = "complete" then if request("action") = "modify" then'now they have chose a specific record... if request("subsubaction") = "complete" then SQL = "UPDATE instructor_tbl SET instructor_name = '"&cleanString(request("iname")) &"', instructor_phone='"&request("iphone") &"', instructor_email='"&request("iemail") &"' WHERE instructor_id="&request("id")&";" SET CONN=server.createobject("ADODB.connection") Conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

The instructor's information was successfully modified.

" else'they want a preloaded form to make changes on SQL = "SELECT * FROM instructor_tbl WHERE instructor_id="&request("id")&";" SET CONN=server.createObject("ADODB.connection") CONN.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SET RS=server.CreateObject("ADODB.recordset") RS.Open SQL, CONN %>
"> Instructor's Name
"> Phone Number
"> Instructor's Email
">
<% rs.close set rs = nothing conn.close set conn=nothing end if'end of either modify preloaded form or modify run SQL else'subaction=COMPLTE and ACTION=DELETE SQL = "DELETE * FROM instructor_tbl WHERE instructor_id="&request("id")&";" SET CONN=server.createobject("ADODB.connection") Conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

The instructor was successfully deleted form the database.

" end if'end of modify or delte SQL else'SUBACTION is not yet complete, MOD and DEL share this common form... 'get a RS of all instructor... 'make a table in a form with checkboxes for delete 'make a tags go to modify SQL... 'Make checkboxes plus submit delete record... SQL = "SELECT * FROM instructor_tbl" SET CONN=server.createObject("ADODB.connection") CONN.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SET RS=server.CreateObject("ADODB.recordset") RS.Open SQL, CONN, 2 rs.movefirst Response.write"" While NOT Rs.EOF id=rs("instructor_id") response.write "" rs.movenext WEND response.write"
"&cleanHTMLstring(rs("instructor_name"))&""&rs("instructor_email")&""&rs("instructor_phone")&"modifydelete
" rs.close set rs = nothing conn.close set conn=nothing end if'end of modify and delete sections end if'end of all options %>