Contents of s0972midans.asp:
<html> <head> <style type="text/css"> a:link {color:blue;} a:visited {color:blue;} a:active {color:blue;} a:hover {color:red;} </style> </head> <body> <b>MIS 4372 Spring 2009 Midterm Parks</b> <p> <% sub p1 set rs=server.createobject("ADODB.Recordset") sql="SELECT * from s09project" rs.open sql,"DSN=gl001;UID=gl001;PWD=11111;" response.write "<p><b>Pick a Project:</b><p>" while not rs.eof response.write "<p><a href='s0972midans.asp?t=2&pid="+cstr(rs("proj_id"))+"'> "+rs("proj_name")+"</a>" rs.movenext wend rs.close set rs=nothing end sub sub p2 set rs=server.createobject("ADODB.Recordset") sql="SELECT * from s09project WHERE proj_id="+cstr(Request.querystring("pid")) rs.open sql,"DSN=gl001;UID=gl001;PWD=11111;" response.write "<p>Project ID="+cstr(rs("proj_id"))+" Project Name="+cstr(rs("proj_name")) pid=rs("proj_id") rs.close sql="SELECT * from s09drawings WHERE proj_id="+cstr(Request.querystring("pid")) response.write "<p>[trace of sql="+sql+"]" rs.open sql,"DSN=gl001;UID=gl001;PWD=11111;" while not rs.eof response.write "<p><a href='s0972midans.asp?t=3&ds="+cstr(rs("drawing_set"))+"&pid="+cstr(pid)+"'> Drawing Set="+cstr(rs("drawing_set"))+"</a> Project_id="+cstr(pid) response.write " type="+cstr(rs("drawing_type"))+" desc="+cstr(rs("drawing_desc")) rs.movenext wend rs.close set rs=nothing end sub sub p3 set rs=server.createobject("ADODB.Recordset") sql="SELECT * from s09drawings WHERE proj_id="+cstr(Request.querystring("pid"))+" AND drawing_set="+cstr(request.QueryString("ds")) rs.open sql,"DSN=gl001;UID=gl001;PWD=11111;" response.write "<p>Project ID="+cstr(request.querystring("pid")) response.write "<p>Drawing Set="+cstr(rs("drawing_set")) response.write "<p>Drawing Type="+cstr(rs("drawing_type")) response.write "<p>Drawing Description="+cstr(rs("drawing_desc")) %> <form name="f" action s0972midans.asp" method="GET"> <p>File <input type="text" size="30" name="f" maxlength="30" value="<% =rs("drawing_file") %>"> <p>Date <input type="text" size="30" name="d" maxlength="30" value="<% =rs("drawing_date") %>"> <p>Version <input type="text" size="6" maxlength="6" name="v" value="<% =rs("drawing_version") %>"> <p> <input type="hidden" name="ds" value="<% = cstr(request.querystring("ds")) %>"> <input type="hidden" name="pid" value="<% = cstr(request.querystring("pid")) %>"> <input type="hidden" name="t" value="4"> <input type="submit"></form> <% end sub sub p4 pid=cstr(request.querystring("pid")) ds=cstr(request.querystring("d")) set cn=server.createobject("ADODB.Connection") cn.open "gl001","gl001","11111" cn.beginTrans response.write "<p>Begin the transaction..." set cm=Server.CreateObject("ADODB.Command") set cm.ActiveConnection = cn cm.CommandText="UPDATE s09drawings set drawing_file=?, drawing_date=?, drawing_version=? WHERE proj_id=? AND drawing_set=?" cm.parameters.refresh cm(0)=Request.querystring("f") cm(1)=Request.querystring("d") cm(2)=Request.querystring("v") cm(3)=cint(Request.querystring("pid")) cm(4)=cint(Request.querystring("ds")) response.write "<p>CommandText="+cstr(cm.CommandText)+"<P>Parameters:" for i=0 to 4 response.write "<br>Parameter "+cstr(i)+" ="+cstr(cm(i)) next cm.execute numa if numa=1 then response.write "<p>Update OK numa="+cstr(numa)+", committed the transaction" cn.commitTrans else response.write "<p>Update Failed numa="+cstr(numa)+", rolled back the transaction" cn.rollbackTrans end if cn.close set cn=nothing end sub ' '***MAIN ' t=request.querystring("t") response.write "<P>Current token="+cstr(t) select case t case "" call p1 case "2" call p2 case "3" call p3 case "4" call p4 end select %> <p> <hr> <p> See the <a href="http://www.bauer.uh.edu/parks/s0972m.htm">exam</a><br> See the code for this program (part I of the exam <a href="bdoc.asp?fl=s09p1">here</a>)<br> See the current drawings table (part II of the exam <a href="s0972midans2.asp">here</a>)<br> </body></html>
***** end of file *** printed: 129 lines on: 11/23/2009 5:58:41 AM