主题:  请救救我吧?

sky_5d

职务:普通成员
等级:1
金币:0.0
发贴:121
注册:2001/5/17 10:37:42
#12001/9/16 14:24:41
我做了一下留言板,全部功能可以用,就是del留言就出现以下错误。。
请问谁遇过这种问题。
ADODB.Field 错误 '800a0bcd'

BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,但应用程序要求操作的是当前的记录。

/JINGWEI/WEB/login/del_guest.asp, 行196


我需要力量

tonton_5d

职务:普通成员
等级:2
金币:1.0
发贴:176
注册:2001/8/7 23:57:56
#22001/9/16 14:25:47
把那一段代码拿来看看。


免费提供XML计数器服务 www.tonton.cn

sky_5d

职务:普通成员
等级:1
金币:0.0
发贴:121
注册:2001/5/17 10:37:42
#32001/9/16 14:34:47
<%@LANGUAGE="VBSCRIPT"%>

<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Delete Record: declare variables

if (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then

MM_editConnection = MM_JINGG_STRING
MM_editTable = "guest"
MM_editColumn = "ID"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "del_guest.asp"

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then

' create the sql delete statement
MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then
' execute the delete
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_JINGG_STRING
Recordset1.Source = "SELECT * FROM guest ORDER BY ID desc"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 10
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>












 




<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>






<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
<%=(Recordset1.Fields.Item("name").value)%> <%=(Recordset1.Fields.Item("type").value)%> <%=(Recordset1.Fields.Item("time").value)%>



">


 


<%
Recordset1.Close()
%>

编辑历史:[这消息被sky编辑过(编辑时间2001-09-16 14:35:58)]

我需要力量

tonton_5d

职务:普通成员
等级:2
金币:1.0
发贴:176
注册:2001/8/7 23:57:56
#42001/9/16 18:09:40
196行是哪一行?


免费提供XML计数器服务 www.tonton.cn

sky_5d

职务:普通成员
等级:1
金币:0.0
发贴:121
注册:2001/5/17 10:37:42
#52001/9/17 11:30:41
好像只有146行


我需要力量

绿茶

职务:普通成员
等级:8
金币:10.0
发贴:19267
注册:2000/12/28 12:10:01
#62001/9/17 12:24:11
很明显的问题嘛,你想操作的是一条不存在的记录,它当然会出错了。



sky_5d

职务:普通成员
等级:1
金币:0.0
发贴:121
注册:2001/5/17 10:37:42
#72001/9/17 13:16:48
我已经重复做过几了,可是也重复同样的错误,以前是不怕的,连UD我都重装过了,那应该是什么问题?

请高手指点一下。。。谢谢。。。。


我需要力量

xpilot

职务:普通成员
等级:1
金币:1.0
发贴:192
注册:2001/5/24 14:29:02
#82001/9/17 13:56:02
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_JINGG_STRING
Recordset1.Source = "SELECT * FROM guest ORDER BY ID desc"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>

上面的代码有问题缺少Where语句,UD的删除只能指定一条数据中的记录,而你上面的语句没有指定要删那条记录,程序找不到指定的记录就会报“BOF 或 EOF 中有一个是“真””的错,所以应该有例如:
where ID(你的留言编号) = bh(你自己定义的变量) ‘这样的语句!
bh 的值可以从浏览器窗口以Request("编号变量")来取得,然后就可以了!还是属于SQL语法不熟练造成的。



tonton_5d

职务:普通成员
等级:2
金币:1.0
发贴:176
注册:2001/8/7 23:57:56
#92001/9/17 14:29:59
哎。删除记录还要那么费事,我无话可说了。。。


免费提供XML计数器服务 www.tonton.cn