请解决 ADODB.Recordset (0x800A0E78)对象关闭时不允许操作的错误
<%
requestid=request("id")
'******************以下部分为读取用户名,再从表'kb'中删除该用户课表**************************
Set rs=server.createobject("adodb.recordset")
sql="select * from jg where id="&requestid&""
rs.open sql,conn
name=rs("name") '读取用户名
rs.close
set rs=nothing
Set rs=server.createobject("adodb.recordset")
sql="select * from kb where name='"&name&"'"
if not(rs.bof and rs.eof) then
sql="delete * from kb where name='"&name&"'"
rs.open sql,conn
end if
rs.close
set rs=nothing
'*******************删除课表结束***********************
Set rs=server.createobject("adodb.recordset")
sql="delete from jg where id="&requestid&"" '删除用户资料
rs.open sql,conn
on error resume next
set DelObj=Server.CreateObject("Scripting.FileSystemObject")
filepath="upload/"&img ' 修改相片路径
Delpath=server.mappath(filepath)
set DelFi=DelObj.getfile(Delpath)
DelFi.Delete
set Delobj=nothing
'-----------------------***************
ip111 = Request.ServerVariables("HTTP_X_FORWARDED_FOR") ' 代理IP
ip222 =Request.ServerVariables("REMOTE_ADDR")
if ip111 = "" then
ipupdate = ip222
else
ipupdate = ip111
end if
jgpcname=Request.ServerVariables("HTTP_USER_AGENT")
sql_jgupddiary="select * from deljgdiary"
set rs_jgupddiary=server.CreateObject("adodb.recordset")
rs_jgupddiary.open sql_jgupddiary,conn,1,2
rs_jgupddiary.addnew
rs_jgupddiary("jg_name")=rs("name") '教工姓名
rs_jgupddiary("lastupduser")=session("adminlogin")
rs_jgupddiary("lastupdname")=session("adminname")
rs_jgupddiary("lastupddate")=now
rs_jgupddiary("lastupdip")=ipupdate
rs_jgupddiary("os")=jgpcname
rs_jgupddiary.update
rs_jgupddiary.close
set rs_jgupddiary=nothing
'------------------------------********************
response.Write "<script language=javascript>{window.alert('恭喜您,该教工的资料和相片全部成功删除');window.history.go(-2);}</script>"
rs.close
set rs=nothing
%>
requestid=request("id")
'******************以下部分为读取用户名,再从表'kb'中删除该用户课表**************************
Set rs=server.createobject("adodb.recordset")
sql="select * from jg where id="&requestid&""
rs.open sql,conn
name=rs("name") '读取用户名
rs.close
set rs=nothing
Set rs=server.createobject("adodb.recordset")
sql="select * from kb where name='"&name&"'"
if not(rs.bof and rs.eof) then
sql="delete * from kb where name='"&name&"'"
rs.open sql,conn
end if
rs.close
set rs=nothing
'*******************删除课表结束***********************
Set rs=server.createobject("adodb.recordset")
sql="delete from jg where id="&requestid&"" '删除用户资料
rs.open sql,conn
on error resume next
set DelObj=Server.CreateObject("Scripting.FileSystemObject")
filepath="upload/"&img ' 修改相片路径
Delpath=server.mappath(filepath)
set DelFi=DelObj.getfile(Delpath)
DelFi.Delete
set Delobj=nothing
'-----------------------***************
ip111 = Request.ServerVariables("HTTP_X_FORWARDED_FOR") ' 代理IP
ip222 =Request.ServerVariables("REMOTE_ADDR")
if ip111 = "" then
ipupdate = ip222
else
ipupdate = ip111
end if
jgpcname=Request.ServerVariables("HTTP_USER_AGENT")
sql_jgupddiary="select * from deljgdiary"
set rs_jgupddiary=server.CreateObject("adodb.recordset")
rs_jgupddiary.open sql_jgupddiary,conn,1,2
rs_jgupddiary.addnew
rs_jgupddiary("jg_name")=rs("name") '教工姓名
rs_jgupddiary("lastupduser")=session("adminlogin")
rs_jgupddiary("lastupdname")=session("adminname")
rs_jgupddiary("lastupddate")=now
rs_jgupddiary("lastupdip")=ipupdate
rs_jgupddiary("os")=jgpcname
rs_jgupddiary.update
rs_jgupddiary.close
set rs_jgupddiary=nothing
'------------------------------********************
response.Write "<script language=javascript>{window.alert('恭喜您,该教工的资料和相片全部成功删除');window.history.go(-2);}</script>"
rs.close
set rs=nothing
%>
由上一程序传递ID及IMG两个参数,红色部分为我所加,意思是先由ID读出用户名,再把该用户名的信息在“KB”表中删除,但以上代码中删除红色部分代码就正常,否则就出错:
ADODB.Recordset (0x800A0E78)
对象关闭时,不允许操作。请问原因在哪?