一个网页问题,请帮忙

来源:百度知道 编辑:UC知道 时间:2024/07/07 11:58:53
我做了一个搜索页面,总是出错:
错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/cyxjcy/connect/JCY/Jcyllyj/serch3.asp, 第 56 行

附代码:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../../Connections/cyxjcy.asp" -->
<%
Dim Recordset1__acc
Recordset1__acc = "1"
If (request.form("textfield") <> "") Then
Recordset1__acc = request.form("textfield")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_cyxjcy_STRING
Recordset1.Source = "SELECT * FROM CYXJCYllyj WHERE Btitle like '%" + Replace(Recordset1__acc, "'", "''") + "%' ORDER BY ID DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1

用的是什么浏览器?

你没有对数据库为空时做判断或是判断放在了执行调用的前面。
<table width="360" border="0">
<tr>
<td>标题</td>
<td>作者</td>
</tr>
<tr>
<td><%=(Recordset1.Fields.Item("Btitle").Value)%></td>
<td><%=(Recordset1.Fields.Item("Bwriter").Value)%></td>
</tr>
</table>
里面没有对空数据库进行判断,应该为(可能不行,因为手写的代码跟dw有差别,具体的你要好好学习):
<%if not recordset1.eof then%>
<table width="360" border="0">
<tr>
<td>标题</td>
<td>作者</td>
</tr>
<tr>
<td><%=(Recordset1.Fields.Item("Btitle").Value)%></td>
<td><%=(Recordset1.Fields.Item("Bwriter").Value)%></td>
</tr>
</table>
<%end if%>
我看到你是用dw生成代码的,这是很不好的。最好用手写代码,易改,易懂。