Contents of update1.asp:
<html> <head> <script language="VBScript"> <!--- sub checkit if NOT isNumeric(document.xform.ssn.value) then msgbox "ssn is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.mon_hrs.value) then msgbox "Monday Hours is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.mon_hrs.value) then msgbox "Monday Hours is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.tue_hrs.value) then msgbox "Tuesday Hours is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.wed_hrs.value) then msgbox "WEDNESDAY Hours is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.thu_hrs.value) then msgbox "Thursday Hours is NOT a number. Re-enter" exit sub end if if NOT isNumeric(document.xform.fri_hrs.value) then msgbox "Friday Hours is NOT a number. Re-enter" exit sub end if document.xform.submit end sub ---> </script> </head> <body> <b>UPDATE WEEKLY TIMECARD</b> <p> <form name="xform" method="GET" action="update1.asp"> <% sub pass1 %> <p> Enter SSN to Modify <input type="text" size="11" name="ssn"> <input type="hidden" name="token" value="2"> <p> <input type="submit"> <% end sub sub pass2 set rs=server.CreateObject("ADODB.Recordset") os="SELECT * FROM weekly_timecard WHERE ssn=" os=os+cstr(Request.Querystring("ssn")) response.write "<p>os="+os rs.open os,"DSN=gl001;UID=gl001;PWD=11111" response.write "<p>rs opened ok" if rs.eof then response.write "<p><b>Update cannot be processed. SSN="+cstr(request.querystring("ssn"))+" doesn't exist in the database!</b>" response.write "<p>Click the BACK button and re-enter a valid SSN." else %> <p><b>THIS WEEK'S HOURS FOR SSN=<% = request.querystring("ssn")%></b> <input type="hidden" name="ssn" size="11" value="<% = request.querystring("ssn") %>"> <p> LAST NAME <input type="text" name="last_name" size="30" value="<% = rs("last_name") %>"> <br>FIRST NAME <input type="text" name="first_name" size="15" value="<% = rs("first_name") %>"> <br>MIDDLE NAME <input type="text" name="middle_name" size="15" value="<% = rs("middle_name") %>"> <br>MON <input type="text" name="mon_hrs" size="2" value="<% = rs("mon_hrs") %>"> <br>TUE <input type="text" name="tue_hrs" size="2" value="<% = rs("tue_hrs") %>"> <br>WED <input type="text" name="wed_hrs" size="2" value="<% = rs("wed_hrs") %>"> <br>THU <input type="text" name="thu_hrs" size="2" value="<% = rs("thu_hrs") %>"> <br>FRI <input type="text" name="fri_hrs" size="2" value="<% = rs("fri_hrs") %>"> <input type="hidden" name="token" value="3"> <P> <input type="button" onClick="checkit" value="submit"> <% rs.close set rs=nothing end if end sub sub pass3 set cn = Server.CreateObject("ADODB.Connection") fdsn="gl001" fuid="gl001" fpwd="11111" cn.open fdsn,fuid,fpwd response.write "cn open ok" Update_string="UPDATE weekly_timecard set last_name=" Update_string=Update_string+chr(39)+cstr(Request.Querystring("last_name"))+chr(39) Update_string=Update_string+", first_name="+chr(39)+cstr(Request.Querystring("first_name"))+chr(39) Update_string=Update_string+", middle_name="+chr(39)+cstr(Request.Querystring("middle_name"))+chr(39) Update_string=Update_string+", mon_hrs="+cstr(Request.Querystring("mon_hrs")) Update_string=Update_string+", tue_hrs="+cstr(Request.Querystring("tue_hrs")) Update_string=Update_string+", wed_hrs="+cstr(Request.Querystring("wed_hrs")) Update_string=Update_string+", thu_hrs="+cstr(Request.Querystring("thu_hrs")) Update_string=Update_string+", fri_hrs="+cstr(Request.Querystring("fri_hrs")) +" WHERE ssn="+cstr(Request.QueryString("ssn") ) response.write "<p>Update_string="+cstr(Update_string) cn.execute Update_string, numa if numa = 1 then response.write "<p>Updated OK" response.write "<p><a href='update1.asp'> here</a> to update another" else response.write "<p>Update failed!!<p>" response.write "<br>Likely cause is that ssn="+cstr(request.querystring("ssn")) + " no longer exists in the database." end if cn.close set cn=nothing end sub sub errorpass response.write cstr(request.Querystring("token")) end sub ' '*** top of main ' token=request.Querystring("token") response.write "<p>token--->"+cstr(request.Querystring("token"))+"<----<p>" select case token case "" call pass1 case "2" call pass2 case "3" call pass3 case else call errorpass end select %> </form> </body> </html>
***** end of file *** printed: 149 lines on: 11/23/2009 5:55:49 AM