标题:对象关闭不允许操作?
只看楼主
cssart
Rank: 1
等 级:新手上路
帖 子:47
专家分:5
注 册:2008-10-11
结帖率:41.67%
已结贴  问题点数:20 回复次数:2 
对象关闭不允许操作?
大家好:请教一小段代码,批量删除产品与产品图片,总是提示“对象关闭时不允许操作”:

<!--#include file="conn.asp"-->
<%
Function DeleteFile(FileName)
FileName=server.MapPath("../UploadFile/"&FileName) '必须转换成绝对路径的
dim Fso
Set Fso = CreateObject("scripting.filesystemobject")
if Fso.FileExists(Filename) then '判断文件是否存在
Fso.DeleteFile filename
end if
Set Fso = nothing
End Function

arrdel=Request("id")

sql="delete from p_info where p_id in ("&arrdel&")"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3

do while not rs.eof
  DeleteFile(rs("p_pic"))
  rs.movenext
loop

conn.Execute sql



Response.write "<script language = 'javascript'>window.document.location.href='admin_pro.asp';</script>"
response.end
%>
搜索更多相关主题的帖子: Request 产品图片 
2011-01-23 16:02
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
得分:20 
<!--#include file="conn.asp"-->
<%
Function DeleteFile(FileName)
FileName=server.MapPath("../UploadFile/"&FileName) '必须转换成绝对路径的
dim Fso
Set Fso = CreateObject("scripting.filesystemobject")
if Fso.FileExists(Filename) then '判断文件是否存在
Fso.DeleteFile filename
end if
Set Fso = nothing
End Function

arrdel=Request("id")

sql="select * from p_info where p_id in ("&arrdel&")"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3

do while not rs.eof
  DeleteFile(rs("p_pic"))
  rs.movenext
loop
sql1="delete from p_info where p_id in ("&arrdel&")"
conn.Execute sql1



Response.write "<script language = 'javascript'>window.document.location.href='admin_pro.asp';</script>"
response.end
%>

QQ:63572063
2011-01-23 17:52
flyabcdef
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-2-18
得分:0 
,学习了
2011-02-20 16:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-331471-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.113048 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved