Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Error Trying to Delete File

Reply
Thread Tools

Error Trying to Delete File

 
 
Keith
Guest
Posts: n/a
 
      01-20-2005
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.


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-20-2005
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.


 
Reply With Quote
 
 
 
 
Keith
Guest
Posts: n/a
 
      01-20-2005
"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:OqOEKYv$(E-Mail Removed)...
> 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.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-20-2005
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.


 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      01-20-2005
"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:%23Mx1$pv$(E-Mail Removed)...
> 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


Both EOF and BOF are False - as I would expect as the Recordset has a record
in it.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-20-2005
Keith wrote:
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:%23Mx1$pv$(E-Mail Removed)...
>> 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

>
> Both EOF and BOF are False - as I would expect as the Recordset has a
> record in it.


That means the field names aren't correct. Do

for each fld in RS_Content.Fields
response.write fld.Name & ": """ & fld.value & """<BR>"
next

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.


 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      01-20-2005

"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:O25%23VJw$(E-Mail Removed)...
> Keith wrote:
>> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
>> news:%23Mx1$pv$(E-Mail Removed)...
>>> 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

>>
>> Both EOF and BOF are False - as I would expect as the Recordset has a
>> record in it.

>
> That means the field names aren't correct. Do
>
> for each fld in RS_Content.Fields
> response.write fld.Name & ": """ & fld.value & """<BR>"
> next
>
> Bob Barrows


It listed all my fields and their contents.

The ones in question:

CON_Issue_Number: "1"
CON_Image: "1.jpg"

This is what I expected.


 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      01-20-2005

"Keith" <@.> wrote in message news:O22ZpNw$(E-Mail Removed)...
>
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:O25%23VJw$(E-Mail Removed)...
>> Keith wrote:
>>> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
>>> news:%23Mx1$pv$(E-Mail Removed)...
>>>> 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
>>>
>>> Both EOF and BOF are False - as I would expect as the Recordset has a
>>> record in it.

>>
>> That means the field names aren't correct. Do
>>
>> for each fld in RS_Content.Fields
>> response.write fld.Name & ": """ & fld.value & """<BR>"
>> next
>>
>> Bob Barrows

>
> It listed all my fields and their contents.
>
> The ones in question:
>
> CON_Issue_Number: "1"
> CON_Image: "1.jpg"
>
> This is what I expected.


Could this be a problem with the web server? And if so what?


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-20-2005
Keith wrote:
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:O25%23VJw$(E-Mail Removed)...
>> Keith wrote:
>>> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
>>> news:%23Mx1$pv$(E-Mail Removed)...
>>>> 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
>>>
>>> Both EOF and BOF are False - as I would expect as the Recordset has
>>> a record in it.

>>
>> That means the field names aren't correct. Do
>>
>> for each fld in RS_Content.Fields
>> response.write fld.Name & ": """ & fld.value & """<BR>"
>> next
>>
>> Bob Barrows

>
> It listed all my fields and their contents.
>
> The ones in question:
>
> CON_Issue_Number: "1"
> CON_Image: "1.jpg"
>
> This is what I expected.


That is just bizarre. The loop runs with no error but referring to the same
field name explicitly throws an error??

Are you sure there's no typos in your code? I'm assuming you ran the loop at
the point in your code where the original error was occurring? Do this (I'm
clutching at straws here):

for each fld in RS_Content.Fields
response.write fld.Name & ": """ & fld.value & """<BR>"
next
on error resume next
Response.Write "RS_Content.Fields.Item(""CON_Issue_Number"").Valu e contains
"
Response.Write RS_Content.Fields.Item("CON_Issue_Number").Value
if err <> 0 then
response.write RS_Content(""CON_Issue_Number"").Value contains "
response.write RS_Content("CON_Issue_Number")
end if
Response.End

--
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.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-20-2005
Keith wrote:
> "Keith" <@.> wrote in message
> Could this be a problem with the web server? And if so what?

None that I have ever encountered.
--
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Help: Guide needed in trying to delete/flush the content of afifo file. MRAB Python 5 11-17-2010 07:29 PM
Access Denied while trying to delete file from python script Viewer T. Python 2 07-14-2007 03:31 PM
Pernisssion denied when trying to delete or mv file Carl Graff Ruby 0 10-13-2006 02:52 PM
Commerce Starter Kit error trying to delete SKU DouglasABaker@gmail.com ASP .Net 0 04-20-2006 01:30 PM
trying to delete .exe file mort Computer Support 3 12-09-2004 04:51 PM



Advertisments