做了个查询页面,但是不知道错了哪里,求各位大虾帮帮忙~~

aijames 2009-07-17 10:03:41
错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/Web/index.asp, 第 57 行


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

网页:
GET /Web/index.asp



----------------------------------------------------------------


<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtshouceID") <> "") Then
Recordset1__MMColParam = Request.Form("txtshouceID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM 通关手册 WHERE 手册编号 = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
-->
</style>
<script type="text/JavaScript">
<!--


function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<table width="729" height="40" border="1" align="center">
<tr>
<td height="17"><div align="center" class="STYLE2">手册编号</div></td>
<td><div align="center" class="STYLE2">申报日期</div></td>
<td><div align="center" class="STYLE2">有效日期</div></td>
<td><div align="center" class="STYLE2">企业内部编号</div></td>
<td><div align="center">经营单位</div></td>
<td><div align="center">加工单位</div></td>
</tr>
<tr>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("手册编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("申报日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("有效日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("企业内部编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("经营单位").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("加工单位").Value)%></td>
</tr>
</table>
<td colspan="4"><div align="center">
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
找不到相关信息
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</div>
<div align="center">
<form id="form1" name="form1" method="post" action="">
<input name="txtshouceID" type="text" id="txtshouceID" />
<input type="submit" name="Submit" value="查询" />
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
...全文
59 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
toury 2009-07-17
  • 打赏
  • 举报
回复

<body>
<table width="729" height="40" border="1" align="center">
<%
If Recordset1.EOF and Recordset1.BOF Then
response.write"<tr><td colspan=10>找不到相关信息d></tr></table>"
Recordset1.Close()
Set Recordset1 = Nothing
response.end
End If
%>
<tr>
<td height="17"><div align="center" class="STYLE2">手册编号</div></td>
<td><div align="center" class="STYLE2">申报日期</div></td>
<td><div align="center" class="STYLE2">有效日期</div></td>
<td><div align="center" class="STYLE2">企业内部编号</div></td>
<td><div align="center">经营单位</div></td>
<td><div align="center">加工单位</div></td>
</tr>
<tr>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("手册编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("申报日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("有效日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("企业内部编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("经营单位").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("加工单位").Value)%></td>
</tr>
</table>
<td colspan="4">
<div align="center">
<form id="form1" name="form1" method="post" action="">
<input name="txtshouceID" type="text" id="txtshouceID" />
<input type="submit" name="Submit" value="查询" />
</form>
</div>
</body>
Y_Leopard 2009-07-17
  • 打赏
  • 举报
回复
少个 End if
aijames 2009-07-17
  • 打赏
  • 举报
回复
错误类型:
Microsoft VBScript 编译器错误 (0x800A03F6)
缺少 'End'
/Web/index.asp, 第 99 行


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

网页:
GET /Web/index.asp

------------------------------------------------
6楼的大虾,还是不行哦~~~
还有我用的是access,不是用sql server。
如果要换其他数据库的话,多很多工序的~~~~
还有人发现问题了吗?
shenzhenNBA 2009-07-17
  • 打赏
  • 举报
回复
修改了以下,试看...

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtshouceID") <> "") Then
Recordset1__MMColParam = Request.Form("txtshouceID")
End If

Dim Recordset1
Dim Recordset1_numRows
dim qSQL

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
qSQL = "SELECT * FROM [通关手册] WHERE [手册编号] = '" & Replace(Recordset1__MMColParam, "'", "''") & "'"
Recordset1.Open qSQL,MM_conn_STRING,1,1


'Recordset1_numRows = 0 '好象没有用到,注释掉
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
-->
</style>
<script type="text/JavaScript">
<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<table width="729" height="40" border="1" align="center">
<tr>
<td height="17"><div align="center" class="STYLE2">手册编号</div></td>
<td><div align="center" class="STYLE2">申报日期</div></td>
<td><div align="center" class="STYLE2">有效日期</div></td>
<td><div align="center" class="STYLE2">企业内部编号</div></td>
<td><div align="center">经营单位</div></td>
<td><div align="center">加工单位</div></td>
</tr>
<%
if Recordset1.bof and Recordset1.eof then
response.write "<tr><td celspan=6>NO data in this Query/找不到相关信息</td></tr>"
else
do while not Recordset1.eof
%>

<tr>
<td><span class="STYLE2"></span><%=Recordset1.Fields("手册编号").Value%></td>
<td><span class="STYLE2"></span><%=Recordset1.Fields("申报日期").Value%></td>
<td><span class="STYLE2"></span><%=Recordset1.Fields("有效日期").Value%></td>
<td><span class="STYLE2"></span><%=Recordset1.Fields("企业内部编号").Value%></td>
<td><span class="STYLE2"></span><%=Recordset1.Fields("经营单位").Value%></td>
<td><span class="STYLE2"></span><%=Recordset1.Fields("加工单位").Value%></td>
</tr>
<%
Recordset1.movenext
loop
%>


</table>
<div align="center">
</div>
<div align="center">
<form id="form1" name="form1" method="post" action="">
<input name="txtshouceID" type="text" id="txtshouceID" />
<input type="submit" name="Submit" value="查询" />
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Y_Leopard 2009-07-17
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 sumjor 的回复:]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtshouceID") <> "") Then
Recordset1__MMColParam = Request.Form("txtshouceID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveCon…
[/Quote].
aijames 2009-07-17
  • 打赏
  • 举报
回复
我是选择“显示区域”|“如果记录集不为空则显示区域”命令。
sumjor 2009-07-17
  • 打赏
  • 举报
回复
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
这句话 如果存在那么“找不到相关信息”??
sumjor 2009-07-17
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtshouceID") <> "") Then
Recordset1__MMColParam = Request.Form("txtshouceID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM 通关手册 WHERE 手册编号 = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
-->
</style>
<script type="text/JavaScript">
<!--


function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<table width="729" height="40" border="1" align="center">
<tr>
<td height="17"><div align="center" class="STYLE2">手册编号</div></td>
<td><div align="center" class="STYLE2">申报日期</div></td>
<td><div align="center" class="STYLE2">有效日期</div></td>
<td><div align="center" class="STYLE2">企业内部编号</div></td>
<td><div align="center">经营单位</div></td>
<td><div align="center">加工单位</div></td>
</tr>
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
找不到相关信息
<%else%>

<tr>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("手册编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("申报日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("有效日期").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("企业内部编号").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("经营单位").Value)%></td>
<td><span class="STYLE2"></span><%=(Recordset1.Fields.Item("加工单位").Value)%></td>
</tr>
</table>
<td colspan="4"><div align="center">

</div>
<%end if%>
<div align="center">
<form id="form1" name="form1" method="post" action="">
<input name="txtshouceID" type="text" id="txtshouceID" />
<input type="submit" name="Submit" value="查询" />
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
aijames 2009-07-17
  • 打赏
  • 举报
回复
在测试的时候可以看到结果,但到了运行页面就出现错误,我按照书本的输入还是有错
请问是代码错误还是数据库有错?
aijames 2009-07-17
  • 打赏
  • 举报
回复
我发现了问题了,问题是..........我操作少了一步,添加少了一样东西
各位实在对不起了,我是大头虾星座的,各位原谅我,我把完整的发给大家看看。分数....分数就平分吧~~~

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("txtshouceID") <> "") Then
Recordset1__MMColParam = Request.Form("txtshouceID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM 通关手册 WHERE 手册编号 = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
.STYLE2 { font-family: "楷体_GB2312";
font-size: 36px;
}
-->
</style>
</head>

<body>
<p align="center"><span class="STYLE2"><strong> 通关手册</strong><strong> 查询</strong></span></p>
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="716" height="40" border="1" align="center" bordercolor="#3399FF">
<tr>
<td><div align="center" class="STYLE1">手册编号</div></td>
<td><div align="center" class="STYLE1">申报日期</div></td>
<td><div align="center" class="STYLE1">有效日期</div></td>
<td><div align="center" class="STYLE1">企业内部编号</div></td>
<td><div align="center" class="STYLE1">加工单位</div></td>
<td><div align="center" class="STYLE1">经营单位</div></td>
</tr>
<tr>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("手册编号").Value)%></div></td>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("申报日期").Value)%></div></td>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("有效日期").Value)%></div></td>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("企业内部编号").Value)%></div></td>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("经营单位").Value)%></div></td>
<td><div align="center" class="STYLE1"><%=(Recordset1.Fields.Item("加工单位").Value)%></div></td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
<div align="center">
<% If Recordset1.EOF And Recordset1.BOF Then %>
<p class="STYLE1">找不到相关记录 </p>
<% End If ' end Recordset1.EOF And Recordset1.BOF %>
</div>
<form id="form1" name="form1" method="post" action="">
<div align="center">
<p><span class="STYLE1">手 册 编 号 :
<input name="txtshouceID" type="text" id="txtshouceID" />
</span> <br />
<input type="submit" name="Submit" value="查询" />
</p>
</div>
</form>
<p align="center"> </p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



半山闲人 2009-07-17
  • 打赏
  • 举报
回复
这个错误很明显,你对一个空的记录集使用了movenext等类似方法,因此产生这个错误,正却应对的方法是在使用这个方法循环前判断记录集是否为空,这样: if not (RS.bof and rs.eof) then

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧