我在学习“10天学会ASP的第八天的教程”时遇到一个问题,请指教
我在学习“10天学会ASP的第八天的教程”时遇到一个问题
学习目的:学会数据库的基本操作4(修改记录)我调试的时候发现运行不稳定,
配置:windows2003 + IIS6.0 使用access的数据库
现象:
我在example8.htm的modify框中输入2或者3(这个数字代表example3.mdb里面guestbook中的字段编号)然后按提交,结果有时候正常显示http://127.0.0.1/example8/example8.asp?id=2中的内容,有时候就显示http://127.0.0.1/example8/example8.asp?id=2&Submit=%CC%E1%BD%BB这个url地址,然后页面就无法显示,这是怎么回事呢?
进入http://127.0.0.1/example8/example8.asp?id=2里面了,我开始修改数据,不管我修改还是没有修改还是怎么修改,按提交结果都是“无法显示网页”url地址对应的是http://127.0.0.1/example8/example82.asp
源代码如下:
文件example8.asp的源代码:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("example3.mdb")
exec="select * from guestbook where 编号="+request.querystring("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
%>
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<form name="form" method="post" action="example82.asp">
<td><input type="text" name="name" value="<%=rs("name")%>"></td>
<td><input type="text" name="tel" value="<%=rs("tel")%>"></td>
<td><input type="text" name="message" value="<%=rs("message")%>"></td>
<td><input type="submit" name="Submit" value="提交"></td>
<input type="hidden" name="id" value="<%=request.querystring("id")%>">
</form> </tr>
</table>
</body>
</html>
文件example8.htm的源代码:这个文件应该没有问题,但是我也先给出他的源代码以便分析
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="get" action="example8.asp">
modify:
<input type="text" name="id">
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>
文件example82.asp的源代码:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("example3.mdb")
exec="select * from guestbook where 编号="&request.form("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
rs("name")=request.form("name")
rs("tel")=request.form("tel")
rs("message")=request.form("message")
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
数据库文件是example3.mdb前面我已经提到,表名为guestbook编号从2到5