Jump to content

non stop loading of an ASP file


quyen

Recommended Posts

I'm having problems with a file that doesn't stop loading. There are two files, the first is the connection info placed in a connections folder

<%MM_school_STRING = "dsn=school;"%>The other is an asp file that allows the user to make changes to records in an MS access database.  Here is the code.  Can anyone work out why it doesn't stop loading, i've been working on it for hours.  I know it is long, but any help would be deeply appreciated.  Thanks<%@LANGUAGE="VBSCRIPT"%><!--#include file="Connections/school.asp" --><%'Retrieve values from the formaction=request("action")teacherID=request("teacherID")firstname=request("firstname")lastname=request("lastname")dept=request("dept")if action="Add" then 	set command1=Server.CreateObject("ADODB.Command")	command1.ActiveConnection = MM_school_STRING	command1.CommandText="INSERT INTO teacher (firstname,lastname,dept) VALUES ('" & firstname & "','" & lastname & "'," & dept & ")"	command1.execute	command1.ActiveConnection.Closeend ifif action="Modify" then 	set command1=Server.CreateObject("ADODB.Command")	command1.ActiveConnection = MM_school_STRING	command1.CommandText="UPDATE teacher SET firstname='" & firstname & "', lastname='" & lastname & "', dept=" & dept & " WHERE teacherID=" & teacherID 	command1.execute	command1.ActiveConnection.Closeend ifif action="Delete" then 	set command1=Server.CreateObject("ADODB.Command")	command1.ActiveConnection = MM_school_STRING	command1.CommandText="DELETE FROM teacher Where teacherID=" & teacherID 	command1.execute	command1.ActiveConnection.Closeend if%><%set teacher = Server.CreateObject("ADODB.Recordset")teacher.ActiveConnection = MM_school_STRINGteacher.Source = "SELECT * FROM teacher"teacher.CursorType = 0teacher.CursorLocation = 2teacher.LockType = 3teacher.Open()teacher_numRows = 0%><%set dept = Server.CreateObject("ADODB.Recordset")dept.ActiveConnection = MM_school_STRINGdept.Source = "SELECT * FROM dept"dept.CursorType = 0dept.CursorLocation = 2dept.LockType = 3dept.Open()dept_numRows = 0%><%Dim Repeat1__numRowsRepeat1__numRows = -1Dim Repeat1__indexRepeat1__index = 0teacher_numRows = teacher_numRows + Repeat1__numRows%><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#929292" background="pictures/BACK.jpg"><p> </p><p> </p><p> </p><p> </p><table width="100%" border="2" bgcolor="#FEFAED" bordercolor="#E3B660">  <tr>     <td width="20%"><b><span teacher="style7">TeacherID:</span></b></td>    <td width="21%"><b><span teacher="style7">Firstname:</span></b></td>    <td width="23%"><b><span teacher="style7">Lastname:</span></b></td>    <td width="22%"><b><span teacher="style7">Dept:</span></b></td>    <td width="14%"> </td>  </tr>    <% While ((Repeat1__numRows <> 0) AND (NOT teacher.EOF)) %>  <tr>  <form name="form1" method="post" action="">     <td width="20%">       <input type="text" name="teacherID" readonly value="<%=(teacher.Fields.Item("teacherID").Value)%>">    </td>    <td width="21%">       <input type="text" name="firstname" value="<%=(teacher.Fields.Item("firstname").Value)%>">    </td>    <td width="23%">       <input type="text" name="lastname" value="<%=(teacher.Fields.Item("lastname").Value)%>">    </td>    <td width="22%">       <select name="dept" size="1">        <%While (NOT dept.EOF)%>        <option value="<%=(dept.Fields.Item("deptID").Value)%>" <%if (CStr(dept.Fields.Item("deptID").Value) = CStr(teacher.Fields.Item("dept").Value)) then Response.Write("SELECTED") : Response.Write("")%>><%=(dept.Fields.Item("name").Value)%></option>        <%  dept.MoveNext()WendIf (dept.CursorType > 0) Then  dept.MoveFirstElse  dept.RequeryEnd If%>      </select>    </td>    <td width="14%">       <input type="submit" name="action" value="Modify">      <input type="submit" name="action" value="Delete">    </td>	</form>  </tr>    <%   Repeat1__index=Repeat1__index+1  Repeat1__numRows=Repeat1__numRows-1  teacher.MoveNext()Wend%>  <tr>  <form name="form2" method="post" action="">     <td width="20%"> </td>    <td width="21%">       <input type="text" name="firstname">    </td>    <td width="23%">       <input type="text" name="lastname">    </td>    <td width="22%">       <select name="select" size="1">        <%While (NOT dept.EOF)%>        <option value="<%=(dept.Fields.Item("deptID").Value)%>" ><%=(dept.Fields.Item("name").Value)%></option>        <%  dept.MoveNext()WendIf (dept.CursorType > 0) Then  dept.MoveFirstElse  dept.RequeryEnd If%>      </select>    </td>    <td width="14%">       <input type="submit" name="action" value="Add">    </td>	</form>  </tr></table><p> </p><table width="98%" border="0">  <tr>     <td width="27%"> </td>    <td width="9%"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="107" height="18">        <param name=movie value="button9.swf">        <param name=quality value=high>        <param name="BGCOLOR" value="">        <embed src="button9.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="107" height="18" bgcolor="">        </embed>       </object></td>    <td width="11%"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="107" height="18">        <param name=movie value="button2.swf">        <param name=quality value=high>        <param name="BGCOLOR" value="">        <embed src="button2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="107" height="18" bgcolor="">        </embed>       </object></td>    <td width="11%"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="107" height="18">        <param name=movie value="button4.swf">        <param name=quality value=high>        <param name="BGCOLOR" value="">        <embed src="button4.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="107" height="18" bgcolor="">        </embed>       </object></td>    <td width="11%"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="107" height="18">        <param name=movie value="button5.swf">        <param name=quality value=high>        <param name="BGCOLOR" value="">        <embed src="button5.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="107" height="18" bgcolor="">        </embed>       </object></td>    <td width="31%"> </td>  </tr></table><p> </p></body></html><%teacher.Close()%><%dept.Close()%>

[edit] wrapped code in codebox - skemcin

Edited by Skemcin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...