473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Error Trying to Delete File

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.
Jul 22 '05 #1
14 1681
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.
Jul 22 '05 #2
"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.
Jul 22 '05 #3
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.
Jul 22 '05 #4
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Jul 22 '05 #5
Keith wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Jul 22 '05 #6

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O2****************@TK2MSFTNGP14.phx.gbl...
Keith wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Jul 22 '05 #7

"Keith" <@.> wrote in message news:O2**************@TK2MSFTNGP10.phx.gbl...

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O2****************@TK2MSFTNGP14.phx.gbl...
Keith wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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?
Jul 22 '05 #8
Keith wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O2****************@TK2MSFTNGP14.phx.gbl...
Keith wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Jul 22 '05 #9
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.
Jul 22 '05 #10
Bob Barrows [MVP] wrote:
Response.Write "RS_Content.Fields.Item(""CON_Issue_Number"").Valu e
contains "


Watch out for unintended line breaks. The above should all be on one line.
--
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.
Jul 22 '05 #11
io

"Keith" <@.> wrote in message news:#a**************@TK2MSFTNGP12.phx.gbl...
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.


Make sure you do not set RS_Content to Nothing somewhere before that code.
It may be a bit hard to spot especially when you use #include with .asp(s)
that use same recordset identifier.

Jul 22 '05 #12
Still having problems here.

Everything I do shows that the recordset contains the correct values, but
the delete still gives me the following error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''
Jul 22 '05 #13
Keith wrote:
Still having problems here.

Everything I do shows that the recordset contains the correct values,
but the delete still gives me the following error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''


We are not going to be able to resolve this without having a way to
reproduce the problem. Strip your app to the bare essentials needed to
demonstrate the issue. Get rid of all non-essential html markup, etc.
Provide sql statements to create the table and insert the sample data into
the table. Post the repro script to the newsgroup and somebody will be able
to help you.

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.
Jul 22 '05 #14

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Keith wrote:
Still having problems here.

Everything I do shows that the recordset contains the correct values,
but the delete still gives me the following error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''


We are not going to be able to resolve this without having a way to
reproduce the problem. Strip your app to the bare essentials needed to
demonstrate the issue. Get rid of all non-essential html markup, etc.
Provide sql statements to create the table and insert the sample data into
the table. Post the repro script to the newsgroup and somebody will be
able
to help you.


I found a way around it.

I set a session variable at the start of the document, use them instead of
referenced to the recordset, and then empty them at the end.

Messy, but works!

I still have no idea why referencing the recordset is not working though.
Jul 22 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft...
3
by: John Black | last post by:
Hi, In debugging a core dump, I run purify against my code, it says several "Free Memory Read" errors. All the errors are on one delete statement. Usually this means some pointer is deleted by...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
4
by: news.microsoft.com | last post by:
I need some help here guys.... i have been simply trying to delete a file from the webserver using asp.net using the following code. System.IO.File.Delete(FullPath); however the error message...
9
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object',...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
1
by: Sam | last post by:
This is probably the wrong group to post this in, but I'm not sure where it should go. If you have suggestions as to another group to post it let me know. In our Nant build file for our...
1
by: sphinney | last post by:
All, I'm not sure how to adequately explain my problem in two sentences or less, so at the risk of providing TMI, here's the condensed verion. I have developed an Access 2002 database file that...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.