baffling 'file not found' error. I dare someone to solve this!

T

TimS

I am getting a baffling File not found error (0x800A0035).

I am writing asp on a windows 2000 server. I build a path and filename from
several fields in a jet database using SQL commands, like this:

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2) & "\pics.ini"

When I try to open the file I get this file not found error (0x800A0035).
However, if explicitly specify the path and filename (as in path2 below)
then it works. If I use path1 then it does not work. path2 was taken by
printing path1 to the browser window and then cutandpaste into my code.

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2 & "\pics.ini")
path2="C:\Inetpub\wwwroot\Tim & Janies Family Web Page\2003\pics.ini
' at this point path1=path2, this can be tested and proven
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.OpenTextFile(path2,1)

Why does the path/filename string built using the database not work but an
apparently IDENTICAL string which is explicitly typed in DOES work? I am
certain that this data is correct and it is not just a problem of me doing
something stupid.

Help?

TimS
 
S

Steven Burn

Surely it should be.........

path1=Server.MapPath(temp1 & "\" & temp2 & "\pics.ini")

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
T

TimS

Steven,

Re: your comment - the resulting path/filename variable is the same whether
the filename is inside or outside of the MapPath function.

This is a problem which is not going to resolve from a syntax correction.
All the relevent factors are contained in this paragraph. Basically, you
have two variables, path1 and path2. If you test them, path1=path2 is TRUE.
path1 was created using the code illustrated below. path2 was created by
printing path1 to the screen and then cut/pasting the path/filename string
into my code. path1 and path2 appear to be identical. However, path1 gives
a file not found error and path2 works, as shown in the code below.

If you don't already know the answer, I wager you will not be able to figure
it out. I am hoping someone already knows the answer :) ....please!

TimS
 
S

Steven Burn

Why don't you just do a Response.Write on the path thats not working and see
what it actually contains?

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
B

Bob Barrows

TimS said:
I am getting a baffling File not found error (0x800A0035).

I am writing asp on a windows 2000 server. I build a path and
filename from several fields in a jet database using SQL commands,
like this:

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2) & "\pics.ini"

When I try to open the file I get this file not found error
(0x800A0035). However, if explicitly specify the path and filename
(as in path2 below) then it works. If I use path1 then it does not
work. path2 was taken by printing path1 to the browser window and
then cutandpaste into my code.

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2 & "\pics.ini")
path2="C:\Inetpub\wwwroot\Tim & Janies Family Web Page\2003\pics.ini
' at this point path1=path2, this can be tested and proven
How?

set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.OpenTextFile(path2,1)

Why does the path/filename string built using the database not work
but an apparently IDENTICAL string which is explicitly typed in DOES
work?

Have you done a
Response.Write path1 & "<BR>" & path2
to make sure that they are identical?
 
J

Jeff Cochran

I am getting a baffling File not found error (0x800A0035).

I am writing asp on a windows 2000 server. I build a path and filename from
several fields in a jet database using SQL commands, like this:

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2) & "\pics.ini"

When I try to open the file I get this file not found error (0x800A0035).
However, if explicitly specify the path and filename (as in path2 below)
then it works. If I use path1 then it does not work. path2 was taken by
printing path1 to the browser window and then cutandpaste into my code.

Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
temp2=trim(RS("dirname"))
path1=Server.MapPath(temp1 & "\" & temp2 & "\pics.ini")
path2="C:\Inetpub\wwwroot\Tim & Janies Family Web Page\2003\pics.ini
' at this point path1=path2, this can be tested and proven
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.OpenTextFile(path2,1)

Why does the path/filename string built using the database not work but an
apparently IDENTICAL string which is explicitly typed in DOES work? I am
certain that this data is correct and it is not just a problem of me doing
something stupid.

We're not that certain, you'll have to prove it. Post a
Response.Write of Path1...

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top