尝试删除文件时出错 [英] Error Trying to Delete File

查看:101
本文介绍了尝试删除文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从服务器上删除一个文件(相同的服务器asp app正在运行

on)。我以前做过这个并没有遇到任何问题。


我使用的代码是:


设置File = CreateObject(" Scripting .FileSystemObject")

ImagePath =

Server.MapPath(" .. \..\..\sections \ ezine \ _editions \ i mages \articlethumbs \")

ImagePath = ImagePath& " \" &

(RS_Content.Fields.Item(" CON_Issue_Number")。Value)& " \" &

(RS_Content.Fields.Item(" CON_Image")。Value)


但是,我收到一个指向最后一行的错误上面的代码:


Microsoft VBScript运行时错误''800a01a8''


所需对象:''''

有人可以提供任何帮助吗?我确定我错过了一些简单的东西。这可以长时间盯着这个。

解决方案

Keith写道:< blockquote class =post_quotes>我试图从服务器上删除一个文件(运行相同的服务器asp应用程序)。我以前做过这个并没有遇到任何问题。

我使用的代码是:

设置File = CreateObject(" Scripting.FileSystemObject")
ImagePath =
Server.MapPath(" .. \..\..\sections\ezine\editions\ mages\articlethumbs \")
ImagePath = ImagePath& " \" &
(RS_Content.Fields.Item(" CON_Issue_Number")。Value)& " \" &
(RS_Content.Fields.Item(" CON_Image")。。Value)

但是,我收到一个指向上一行代码的错误
:<微软VBScript运行时错误''800a01a8''

需要对象:''''

任何人都可以提供任何帮助吗?我确定我遗失了一些东西
简单的盯着这么久。




调试。


最后一个语句引用了几个对象。你需要将它们分解成自己的语句,这样你才能发现哪一个导致

错误。


IssueNum = RS_Content.Fields.Item(" CON_Issue_Number")。值

Image = RS_Content.Fields.Item(" CON_Image")。值

ImagePath = ImagePath& " \" &安培; IssueNum& " \" &安培;图片


很明显,这个

RS_Content.Fields.Item(" CON_Issue_Number")。值


可能更简洁地写成:

RS_Content(" CON_Issue_Number")


有些人更喜欢明确命名value属性以避免获取

当Field对象真正想要价值时,但即使他们不坚持

onFields.Item

任何理由你是如此详细?


Bob Barrows

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


" Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom>在消息中写道

新闻:Oq ************* @ TK2MSFTNGP12.phx.gbl ...

Keith写道:

我试图从服务器上删除一个文件(运行相同的服务器asp应用程序)。我以前做过这个并没有遇到任何问题。

我使用的代码是:

设置File = CreateObject(" Scripting.FileSystemObject")
ImagePath =
Server.MapPath(" .. \..\..\sections\ezine\editions\ mages\articlethumbs \")
ImagePath = ImagePath& " \" &
(RS_Content.Fields.Item(" CON_Issue_Number")。Value)& " \" &
(RS_Content.Fields.Item(" CON_Image")。。Value)

但是,我收到一个指向上一行代码的错误
:<微软VBScript运行时错误''800a01a8''

需要对象:''''

任何人都可以提供任何帮助吗?我确定我遗失了一些东西
简单的盯着这么久。



调试。

最后一句话指的是几个对象。您需要将它们分解为自己的语句,以便发现哪一个导致了
错误。

IssueNum = RS_Content.Fields.Item(" CON_Issue_Number") .Value
Image = RS_Content.Fields.Item(" CON_Image")。值
ImagePath = ImagePath& " \" &安培; IssueNum& " \" &安培; Image

很明显,这个
RS_Content.Fields.Item(" CON_Issue_Number")。值

可以更简洁地写成:
RS_Content (CON_Issue_Number)

有些人喜欢明确地命名value属性,以避免在他们真正想要值的时候获得Field对象,但即使他们没有
坚持
onFields.Item
任何理由你是如此冗长?




谢谢


我已经这样做了,现在它失败并且在任一行上都有相同的错误

从记录集中调用一个字段。


Issue_Number包含一个数值,图像包含文字。


任何想法?


我总是这样指RS中的字段 - 没有理由其他就是我的学习方法。


Keith写道:

从记录集中调用字段的行中的任何一行都会出现相同的错误。



这告诉我记录集此时不可用。无论是'b
关闭,超出范围,BOF还是EOF。我想我们需要再看一点代码

来确定是哪种情况。


Response.write RS_Content.EOF


引发错误?这是真的吗?试试BOF


鲍勃巴罗斯

-

微软MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


I am trying to delete a file off a server (same server asp app is running
on). I have done this before and not encountered any problems.

The code I am using is:

Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("..\..\..\sections\ezine\editions\i mages\articlethumbs\")
ImagePath = ImagePath & "\" &
(RS_Content.Fields.Item("CON_Issue_Number").Value) & "\" &
(RS_Content.Fields.Item("CON_Image").Value)

However, I am getting an error pointing to the last line of code above:

Microsoft VBScript runtime error ''800a01a8''

Object required: ''''

Can anyone offer any help please? I''m sure I am missing something simple
from staring at this so long.

解决方案

Keith wrote:

I am trying to delete a file off a server (same server asp app is
running on). I have done this before and not encountered any
problems.

The code I am using is:

Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("..\..\..\sections\ezine\editions\i mages\articlethumbs\")
ImagePath = ImagePath & "\" &
(RS_Content.Fields.Item("CON_Issue_Number").Value) & "\" &
(RS_Content.Fields.Item("CON_Image").Value)

However, I am getting an error pointing to the last line of code
above:

Microsoft VBScript runtime error ''800a01a8''

Object required: ''''

Can anyone offer any help please? I''m sure I am missing something
simple from staring at this so long.



Debugging.

That last statement refers to several objects. You need to break them out
into their own statements so you can discover which one is causing the
error.

IssueNum= RS_Content.Fields.Item("CON_Issue_Number").Value
Image=RS_Content.Fields.Item("CON_Image").Value
ImagePath = ImagePath & "\" & IssueNum & "\" & Image

Incidently, this
RS_Content.Fields.Item("CON_Issue_Number").Value

could more succinctly be written as this:
RS_Content("CON_Issue_Number")

Some people prefer to explicitly name the value property to avoid getting
the Field object when they really want the value, but even they don''t insist
on "Fields.Item"
Any reason you are being so verbose?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Oq*************@TK2MSFTNGP12.phx.gbl...

Keith wrote:

I am trying to delete a file off a server (same server asp app is
running on). I have done this before and not encountered any
problems.

The code I am using is:

Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("..\..\..\sections\ezine\editions\i mages\articlethumbs\")
ImagePath = ImagePath & "\" &
(RS_Content.Fields.Item("CON_Issue_Number").Value) & "\" &
(RS_Content.Fields.Item("CON_Image").Value)

However, I am getting an error pointing to the last line of code
above:

Microsoft VBScript runtime error ''800a01a8''

Object required: ''''

Can anyone offer any help please? I''m sure I am missing something
simple from staring at this so long.



Debugging.

That last statement refers to several objects. You need to break them out
into their own statements so you can discover which one is causing the
error.

IssueNum= RS_Content.Fields.Item("CON_Issue_Number").Value
Image=RS_Content.Fields.Item("CON_Image").Value
ImagePath = ImagePath & "\" & IssueNum & "\" & Image

Incidently, this
RS_Content.Fields.Item("CON_Issue_Number").Value

could more succinctly be written as this:
RS_Content("CON_Issue_Number")

Some people prefer to explicitly name the value property to avoid getting
the Field object when they really want the value, but even they don''t
insist
on "Fields.Item"
Any reason you are being so verbose?



Thanks

I have done that and now it fails with the same error on either of the lines
which call a field from the recordset.

Issue_Number contains a numeric value and Image contains text.

Any ideas?

I always refer to fields in the RS like this - no reason other than that''s
just how I was learned to do it.


Keith wrote:


I have done that and now it fails with the same error on either of
the lines which call a field from the recordset.


That tells me that the recordset is not available at this point. Either it''s
closed, out of scope, BOF, or EOF. I think we need to see a little more code
to determine which is the case. Does

Response.write RS_Content.EOF

raise an error? Does it return true? Try BOF as well

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于尝试删除文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆