asp一个简单问题,后台删除出现错误 '800a0bcd' 哪位大哥帮帮忙?
ADODB.Field错误'800a0bcd'BOF或EOF中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。/cn60165/com_del.as...
ADODB.Field 错误 '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/cn60165/com_del.asp,行 44
代码如下:
<!--#include file="conn.asp"-->
<!--#include file=cookies.asp-->
<%
dim rs,sql,del_username,sql1,sql2,rs1,id,str2,i,all_id,str1,k,username,sql4,str4,a,sql3,sqllo,rslo
all_id=trim(request("selectedid"))
set rs=server.createobject("adodb.recordset")
str1=split(all_id,",")
for k=0 to ubound(str1)
sql="select id from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,1
do while not rs.eof
id=id +","&rs("id")&""
rs.movenext
loop
rs.close
str2=split(id,",")
for i=1 to ubound(str2)
sql="delete from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,3
sql1="delete from [shoucang] where scid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql1,conn,1,3
sql2="delete from [hf] where xxid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
next
sql3="delete from [gbook] where username='"&trim(str1(k))&"' "
rs.open sql3,conn,1,3
call dello()
sql2="delete from [jle_com] where username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
response.write "<li>用户"&trim(str1(k))&"删除成功!"
next
sub dello()
set rslo=server.createobject("adodb.recordset")
sqllo="select * from [jle_com] where username='"&trim(str1(k))&"'"
rslo.open sqllo,conn,1,1
dim logo,fileExt,objFSO
logo=rslo("logo")
fileExt=lcase(right(logo,4))
if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" then
'if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(logo,4)<>"http" then
'call dellogo()
dim whichfile
whichfile=server.mappath("../"& logo & "")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(whichfile) then
objFSO.DeleteFile(whichfile)
end if
set objfso=nothing
set rslo=nothing
end if
end sub
response.write "<script language=JavaScript>" & chr(13) & "alert('删除信息成功!')</script>"
response.write "<meta http-equiv=refresh content=""1;URL=comlist.asp"">"
response.end
rs.close
set rs=nothing
closedb
%>
还是不可以啊 展开
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/cn60165/com_del.asp,行 44
代码如下:
<!--#include file="conn.asp"-->
<!--#include file=cookies.asp-->
<%
dim rs,sql,del_username,sql1,sql2,rs1,id,str2,i,all_id,str1,k,username,sql4,str4,a,sql3,sqllo,rslo
all_id=trim(request("selectedid"))
set rs=server.createobject("adodb.recordset")
str1=split(all_id,",")
for k=0 to ubound(str1)
sql="select id from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,1
do while not rs.eof
id=id +","&rs("id")&""
rs.movenext
loop
rs.close
str2=split(id,",")
for i=1 to ubound(str2)
sql="delete from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,3
sql1="delete from [shoucang] where scid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql1,conn,1,3
sql2="delete from [hf] where xxid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
next
sql3="delete from [gbook] where username='"&trim(str1(k))&"' "
rs.open sql3,conn,1,3
call dello()
sql2="delete from [jle_com] where username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
response.write "<li>用户"&trim(str1(k))&"删除成功!"
next
sub dello()
set rslo=server.createobject("adodb.recordset")
sqllo="select * from [jle_com] where username='"&trim(str1(k))&"'"
rslo.open sqllo,conn,1,1
dim logo,fileExt,objFSO
logo=rslo("logo")
fileExt=lcase(right(logo,4))
if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" then
'if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(logo,4)<>"http" then
'call dellogo()
dim whichfile
whichfile=server.mappath("../"& logo & "")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(whichfile) then
objFSO.DeleteFile(whichfile)
end if
set objfso=nothing
set rslo=nothing
end if
end sub
response.write "<script language=JavaScript>" & chr(13) & "alert('删除信息成功!')</script>"
response.write "<meta http-equiv=refresh content=""1;URL=comlist.asp"">"
response.end
rs.close
set rs=nothing
closedb
%>
还是不可以啊 展开
3个回答
展开全部
建议如下:
1 将以下代码中的rs.open 改成conn.Execute strSql形式:
for i=1 to ubound(str2)
sql="delete from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,3
sql1="delete from [shoucang] where scid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql1,conn,1,3
sql2="delete from [hf] where xxid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
next
sql3="delete from [gbook] where username='"&trim(str1(k))&"' "
rs.open sql3,conn,1,3
call dello()
sql2="delete from [jle_com] where username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
2 将程序结构和代码理顺一下
3 过程dello采用参数传递的方式“引用时:dello(trim(str1(k)))”
sub dello(strusr)
set rslo=server.createobject("adodb.recordset")
sqllo="select * from [jle_com] where username='"& strusr &"'"
rslo.open sqllo,conn,1,1
dim logo,fileExt,objFSO
logo=rslo("logo")
fileExt=lcase(right(logo,4))
if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" then
'if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(logo,4)<>"http" then
'call dellogo()
dim whichfile
whichfile=server.mappath("../"& logo & "")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(whichfile) then
objFSO.DeleteFile(whichfile)
end if
set objfso=nothing
set rslo=nothing
end if
end sub
1 将以下代码中的rs.open 改成conn.Execute strSql形式:
for i=1 to ubound(str2)
sql="delete from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,3
sql1="delete from [shoucang] where scid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql1,conn,1,3
sql2="delete from [hf] where xxid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
next
sql3="delete from [gbook] where username='"&trim(str1(k))&"' "
rs.open sql3,conn,1,3
call dello()
sql2="delete from [jle_com] where username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3
2 将程序结构和代码理顺一下
3 过程dello采用参数传递的方式“引用时:dello(trim(str1(k)))”
sub dello(strusr)
set rslo=server.createobject("adodb.recordset")
sqllo="select * from [jle_com] where username='"& strusr &"'"
rslo.open sqllo,conn,1,1
dim logo,fileExt,objFSO
logo=rslo("logo")
fileExt=lcase(right(logo,4))
if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" then
'if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(logo,4)<>"http" then
'call dellogo()
dim whichfile
whichfile=server.mappath("../"& logo & "")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(whichfile) then
objFSO.DeleteFile(whichfile)
end if
set objfso=nothing
set rslo=nothing
end if
end sub
展开全部
这个问题我也遇到过,在那个删除页面是否添加了response.expires=0,或者在
do while not rs.eof 加个and rs.bof 这类问题似乎和缓存有些关系
do while not rs.eof 加个and rs.bof 这类问题似乎和缓存有些关系
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sql="select id from [jle_xinxi] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,1
if rs.eof then
response.write("<div>此数据不存在</div>")
else
do while not rs.eof
id=id +","&rs("id")&""
rs.movenext
loop
end if
rs.close
如此,做容错处理,出现这个错误是数据库中数据已经不存在了
rs.open sql,conn,1,1
if rs.eof then
response.write("<div>此数据不存在</div>")
else
do while not rs.eof
id=id +","&rs("id")&""
rs.movenext
loop
end if
rs.close
如此,做容错处理,出现这个错误是数据库中数据已经不存在了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询