急急急求答案 ADODB.Field (0x800A0BCD)BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

vic013 2010-05-23 01:45:26
错误类型:
ADODB.Field (0x800A0BCD
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。/dengluch.asp, 第 181 行

第181行代码:<td width="206"><span class="STYLE5"> <a href="chakan.asp?<%= Server.HTMLEncode(MM_keepBoth) & MM_joinChar(MM_keepBoth) & "name=" & Recordset1.Fields.Item("name").Value %>">查看我的通讯录</a> </span> </td>

原代码:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/xiaoyoulu.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("name") <> "") Then
Recordset1__MMColParam = Request.QueryString("name")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_xiaoyoulu_STRING
Recordset1_cmd.CommandText = "SELECT address, E_mail, name, tel FROM xiaoyoulu WHERE name = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 50, Recordset1__MMColParam) ' adVarChar

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!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=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>无标题文档</title>
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:2px;
top:156px;
width:694px;
height:394px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:23px;
top:4px;
width:847px;
height:155px;
z-index:2;
background-color: #33FF33;
}
#apDiv3 {
position:absolute;
left:12px;
top:23px;
width:209px;
height:153px;
z-index:3;
}
h1,h2,h3,h4,h5,h6 {
font-weight: bold;
}
.STYLE1 {
font-size: 60px;
font-weight: bold;
color: #FF9933;
}
#apDiv4 {
position:absolute;
left:23px;
top:161px;
width:846px;
height:273px;
z-index:3;
background-color: #FFFFCC;
}
#apDiv5 {
position:absolute;
left:27px;
top:143px;
width:228px;
height:146px;
z-index:4;
visibility: visible;
}
#apDiv6 {
position:absolute;
left:190px;
top:97px;
width:501px;
height:42px;
z-index:5;
}
.STYLE2 {
color: #FFFF00;
font-size: 24px;
}
.STYLE4 {
color: #FF3300;
font-weight: bold;
font-size: 18px;
}
.STYLE5 {
color: #33FFFF;
font-size: 24px;
font-weight: bold;
}
-->
</style>
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>

<body>
<div id="apDiv4">
<div align="center">
<form id="form1" name="form1">
<p class="STYLE5">恭喜您,登录成功!!!</p>
<table width="433" height="67" border="1">
<tr>
<td width="206"><span class="STYLE5"> <a href="chakan.asp?<%= Server.HTMLEncode(MM_keepBoth) & MM_joinChar(MM_keepBoth) & "name=" & Recordset1.Fields.Item("name").Value %>">查看我的通讯录</a> </span> </td>
<td width="211"><span class="STYLE5"><a href="chaxun.asp">查看校友的通讯录</a> </span></td>
</tr>
</table>
<p class="STYLE5"> </p>
</form>
</div>
</div>
<div id="apDiv6">
<div align="center" class="STYLE2">即使我们各奔东西,但我们仍然心连心!</div>
</div>
<div id="apDiv2">
<div align="center" class="STYLE1">广州大学校友录</div>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



...全文
1184 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
vic013 2010-05-24
  • 打赏
  • 举报
回复
依然无效.............
toury 2010-05-24
  • 打赏
  • 举报
回复
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("name") <> "") Then
Recordset1__MMColParam = Request.QueryString("name")'这是传过来的姓名参数
End If


Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_xiaoyoulu_STRING
''''''''Recordset1_cmd.CommandText = "SELECT address, E_mail, name, tel FROM xiaoyoulu WHERE name = ?" 这里怎么会有个外号呢?
Recordset1_cmd.CommandText = "SELECT address, E_mail, name, tel FROM xiaoyoulu WHERE name = '"&Recordset1__MMColParam&"'" '改成这句
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 50, Recordset1__MMColParam) ' adVarChar

Set Recordset1 = Recordset1_cmd.Execute
'加个判断,看看记录集是否为空:
if Recordset1.eof then
response.write("<h2>记录集是空的!!检查参数和SQL语句是否正确。</h2>")
end if
on error resume next'加这行
Recordset1_numRows = 0
braanwqj64475 2010-05-24
  • 打赏
  • 举报
回复
没有分不让发帖,只好回帖了
求高手帮忙改一段asp代码,收费的也可
代码其实很简单,也很短,只不过我不会asp,看不懂
联系qq 1153606221
a1018615265 2010-05-23
  • 打赏
  • 举报
回复
if not rs.eof and not rs.bof then
.........................
end if


加在你需要验证的代码之间,你看下你的181行附近的执行语句
vic013 2010-05-23
  • 打赏
  • 举报
回复
请问下2楼,怎么判断记录集是不是空啊
小伙真帅 2010-05-23
  • 打赏
  • 举报
回复
一看就又是一个新手。。DW自动生成的代码并不好。建议你以后学着自己写代码,不要用DW的。。


你这个错误,产生的原因就是你的记录集打开后,没有判断它是不是为空,就直接读取记录了,然,当记录集为空时,它是没办法读到值的,所以会产生BOF 或EOF中有一个为真。

解决办法就是:在打开记录集进行读取时,先判断一下它是不是为空的。如果不是空的,再读取。。。
sxdtlcx 2010-05-23
  • 打赏
  • 举报
回复
表中有记录吗?这是自动生成的代码吧。。。

28,390

社区成员

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

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