Contents of bupdate.asp:
<html> <body bgcolor="#cccccc"> <Table border="1"> <tr><td valign='middle' bgcolor='#999999'><img src="captsm.gif"></td> <td valign='middle' bgcolor='#999999'><center><font color="#ffffff"><font face="Comic Sans MS"> <br> <b>A Simple ASP Example<br>Modify (i.e., Update)</b> <br> </td></tr></table> </center> <p> <font face="Comic Sans MS"><b> <p> Execution begins... <p> <% ' '*** globals ' dim cn dim rs dim tokenvalue sub pass1 %> <p> <form name="badgeform" action="http://disc-nt.cba.uh.edu/students/parks/bupdate.asp" METHOD="POST"> Enter the Badge ID to Modify <input type="text" size="10" name="ubid"><p> <input type="hidden" name="token" value="2"><p> <input type="submit"> </form> <% end sub sub pass2 response.write "<P>Pass 2 tokenvalue="+cstr(tokenvalue) set rs=Server.CreateObject("ADODB.Recordset") bidvalue=request.form("ubid") SQLString="SELECT * FROM badge WHERE bid="+cstr(bidvalue) response.write "<P>Open badge rs with SQL--->"+cstr(SQLString)+"<------ " rs.open SQLString,"DSN=gl001;UID=gl001;PWD=11111;" response.write "<P>Recordset opened OK" c=0 while NOT rs.EOF c=c+1 bidfound=rs("bid") blocfound=rs("bloc") bfirstnamefound=rs("blastname") blastnamefound=rs("bfirstname") rs.movenext wend rs.close set rs=nothing if c=0 then response.write "<P>Record not for badge id="+cstr(bidvalue)+" TRY Again" %> <p> <form name="badgeform" action="http://disc-nt.cba.uh.edu/students/parks/bupdate.asp" METHOD="POST"> Enter the Badge ID to Modify <input type="text" size="10" name="ubid"><p> <input type="hidden" name="token" value="2"><p> <input type="submit"> </form> <% else %> <p>Modify the Data Below and then click the submit button: <p> <form name="badgeform" action="http://disc-nt.cba.uh.edu/students/parks/bupdate.asp" METHOD="POST"> Badge ID = <% = bidfound %><p> <input type="hidden" name="ubid" value="<% = cstr(bidfound) %>"> Badge Location <input type="text" size="1" name="ubloc" value="<% =cstr(blocfound) %>"><p> First Name<input type="text" size="10" name="ubfirstname" value="<% =cstr(bfirstnamefound) %>"><p> Last Name<input type="text" size="10" name="ublastname" value="<% =cstr(blastnamefound) %>"> <input type="hidden" name="token" value="3"><p> <input type="submit"> </form> <% end if end sub sub pass3 response.write "<P>Pass 3 tokenvalue="+cstr(tokenvalue) set cn=Server.CreateObject("ADODB.Connection") cn.open "gl001","gl001","11111" response.write "<P>Connection created OK" SQLString="UPDATE badge SET " SQLString=SQLString+ " bloc= "+ chr(39) + request.form("ubloc") + chr(39) + "," SQLString=SQLString+ " blastname = "+ chr(39) + request.form("ublastname") +chr(39) + "," SQLString=SQLString+ "bfirstname = "+ chr(39) + request.form("ubfirstname") +chr(39) SQLString=SQLString+ " WHERE bid="+cstr( request.form("ubid") ) response.write "<P>Ready for UPDATE with SQLString="+cstr(SQLString) cn.execute SQLString,numa if numa=1 then response.write "<P>Modified OK" else if numa= 0 then response.write "<P>Modify Failed. Number of records modified = "+cstr(numa)+ " record not found" else response.write "<P>Modify Occured WITH MORE THAN ONE RECORD. Number of records modified = "+cstr(numa) end if end if cn.close set cn=nothing response.write "<P>Terminating normally" end sub sub passerror response.write "<p>INVALID TOKEN VALUE. token="+cstr(tokernvalue) end sub ' '*** top of main ' tokenvalue=request.form("token") select case tokenvalue case "" call pass1 case "2" call pass2 case "3" call pass3 case else call passerror end select %> <p> <a href="bdoc.asp?fl=u"> Click here for the program listing </a> (bupdate.asp)<br> </body> </html>
***** end of file *** printed: 145 lines on: 11/23/2009 5:53:04 AM