清风半夜鸣蝉的上一句:这段asp查询代码有问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 04:08:29
这段代码运行不显示错误
但是很慢 cpu占用率很高 硬盘狂转
只是一句很简单的查询
到了38%的时候 网页就停在那里
等一下就超时了 显示不了
请问什么原因
代码如下:
<%
on error resume next
Set Conn=Server.CreateObject("ADODB.Connection")
db="lyDB/woaiwangyan.mdb"
connstr ="Provider = Microsoft.Jet.OLEDB.4.0; Data Source ="& Server.MapPath(db)
Conn.Open connstr
%>
<%
sql = "SELECT * FROM option1 "
rs.open sql,conn,1,1
%>

<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">
<%
do while not rs.eof
%><tr>
<td><%=rs("row1")%></td>

</tr>
<%
rs.movenext
loop
%>
</table>
</body>
</html>
原来没定义记录集 ^_^

把 on error resume next 去掉

再运行试试

on error resume next
是大忌, 除非特殊情况,不要使用,尤其在 开发 和 DEBUG阶段