胎儿心脏强光斑是什么:asp问题报错

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 12:55:38
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include FILE="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>数据查询</title>
</head>

<body>
<center>

<font size="4" face="楷体">查询</font>
<p>
<form action="search.asp" method="post">
请输入查询关键字:
<input type="text" name="txtname">
<input type="submit" value="确定">
</form>
</center>
<%
file_name=request("txtname")
if file_name="" then
response.write("没有输入查询关键字,请重新输入!")
response.end

end if

set newconn=Server.CreateObject("ADODB.Connection")
Dbpath=Server.Mappath("/")+"data.mdb"
conn.Open"driver={Microsoft Access Driver (*.mdb)};dbq="&DBpath
SQLcmd="select * from txt where file_name='"&file_name&"' and sold<23" // 查询条件可自己更改
set rs=newconn.execute(SQLcmd)
if rs.eof then
%>

<font size="5" color="blue"><center>
找不到这些同学的记录,请重新输入关键字</font></center><p>
<%else%>

<table align="center">
<tr bgcolor="aqua">
<th>编号
<th>姓名
<th>编号
<th>年龄
<th>住址
<th>联系方式
<th>个人爱好
<%do while not rs.eof%>
<tr bgcolor="yellow">
<%for i=0 to rs.Fields.Count-1%>
<td><%=rs(i)%>
<%next%>

<%
rs.close
rs.movenext
loop
newconn.close
end if
%>
</body>
</html>
代码有什么错误?
总是报

错误类型:
ADODB.Connection (0x800A0E79)
对象打开时,不允许操作。
/office/usefull/search.asp, 第 31 行

浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; Alexa Toolbar)

网页:
POST 14 ??? /office/usefull/search.asp

POST Data:
txtname=%B0%A1
谢谢大家!!!

<%
file_name=request("txtname")
if file_name="" then
response.write("没有输入查询关键字,请重新输入!")
response.end

end if

set newconn=Server.CreateObject("ADODB.Connection")
Dbpath=Server.Mappath("/")+"data.mdb"
conn.Open"driver={Microsoft Access Driver (*.mdb)};dbq="&DBpath
SQLcmd="select * from txt where file_name='"&file_name&"' and sold<23" // 查询条件可自己更改
set rs=newconn.execute(SQLcmd)
if rs.eof then
%>

在这里怎么实现模糊查询?
嘿嘿~~`
谢谢各位

就是就是!
把rs.close 移到 loop外面去,就OK了!估计你是看错循环层了,
里面的是遍历一个记录的所有字段,外面的才是遍历所有记录的循环!

rs.close
rs.movenext
loop
newconn.close
end if

对象已经关闭了,怎么循环呢
改成
rs.movenext
loop

end if
rs.close
newconn.close

同意楼上的