 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 28th, 2009, 09:41 AM
|
|
Authorized User
|
|
Join Date: Apr 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
retriveing data from a XLM file
Hi all,
I am a newby when it come to XML and fairly new with classic ASP.
I have a unit in the field that when it fails the tech plugs in an USB drive to dump the log files. What I need to do is when the USB drive comes in I need to retrieve data out of several XML files. I can read the files into recordsets if I move the files to a virtual directory. I want to eliminate that step and read direct from the USB drive.
I am using this code when the file is on the virtual directory:
Code:
<%@ Language=VBScript %>
<!--#include file="adovbs.inc" -->
<%
Dim adoRS 'ADODB.Recordset
Set adoRS = CreateObject("ADODB.Recordset")
' Set up the Connection
adoRS.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
' Open the XML source
adoRS.Open Server.MapPath(".") & "\portfolio.xml"
This is the code I am trying to use when reading from the USB drive:
Code:
<%@ Language=VBScript %>
<!--#include file="adovbs.inc" -->
<%
Dim adoRS 'ADODB.Recordset
Set adoRS = CreateObject("ADODB.Recordset")
' Set up the Connection
adoRS.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
' Open the XML source
adoRS.Open ("e:/portfolio.xml")
Using this I get the following error;
msxml2.dll error '80040e21'
The device is not ready. /testdev/davie/davieworking/testOSP.asp, line 14
line 14 is: adoRS.Open ("e:/portfolio.xml")
Can any one help me or can this even be done?
|
|

July 28th, 2009, 02:13 PM
|
|
Authorized User
|
|
Join Date: Apr 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Found part of the problem; the USB drive is not being recognized
|
|

July 29th, 2009, 01:38 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Well, for one thing, there is no such file on any Windows machine as "e:/portfolio.xml".
There *might* be, however, a file named "e:\portfolio.xml".
Windows does not recognize / as a file path character. Some programs in windows will convert the / to \ for you, but you shouldn't rely on that.
|
|

July 29th, 2009, 09:24 AM
|
|
Authorized User
|
|
Join Date: Apr 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Also the fact that the e drive is not a virtual directory so it is not on the server might have something to do with not seeing the file.
Quote:
Originally Posted by Old Pedant
Well, for one thing, there is no such file on any Windows machine as "e:/portfolio.xml".
There *might* be, however, a file named "e:\portfolio.xml".
Windows does not recognize / as a file path character. Some programs in windows will convert the / to \ for you, but you shouldn't rely on that.
|
|
|

July 29th, 2009, 02:48 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Hmmm...no, I don't think so.
You said *this* code worked:
adoRS.Open Server.MapPath(".") & "\portfolio.xml"
But then the file, *AS SEEN* by the Open method, is *NOT* a "virtual directory."
When you use Server.MapPath, you *are* converting a virtual path to an absolute Windows file system path.
Try it!
Just do
Response.Write Server.MapPath(".") & "\portfolio.xml" & "<HR>"
You will see something like
d:\some\path\to\portfolio.xml
Just a pure windows path. And *THAT* is all that the Open method sees. As you could prove to your self by doing
adoRS.Open "d:\some\path\to\portfolio.xml"
So, no, I don't think the fact the it's not a virtual directory is at all relevant.
|
|
The Following User Says Thank You to Old Pedant For This Useful Post:
|
|
|

July 29th, 2009, 03:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
The problem COULD be permissions.
Even though YOU can see the E: drive, it's possible that IUSR_XXXX (where XXXX is the name of your computer) doesn't have any privileges to it. IUSR_XXXX is the user that IIS--and thus ASP and thus ADO--runs as.
I'm not sure how to ensure that a plug-in drive gives permissions to users other than Admin-level users. Good questions for a Windows expert. Obviously, you can do it by hand, but it would be a pain to have to do that each time you plugged it in.
|
|
The Following User Says Thank You to Old Pedant For This Useful Post:
|
|
|

July 29th, 2009, 04:23 PM
|
|
Authorized User
|
|
Join Date: Apr 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
I did your suggestion and the
Response.Write Server.MapPath(".") & "\portfolio.xml" & "<HR>"
and got a path in response but doing either;
adoRS.Open "D:\Web Sites\WayneIntranet\testdev\davie\davieworking\por tfolio.xml"
or
adoRS.Open Server.MapPath(".") & "\portfolio.xml"
On that line I received this error;
msxml2.dll error '80040e21'
The system cannot locate the object specified.
/testdev/davie/davieworking/testOSP.asp, line 13
In my original post the code that worked; I misunderstood the code, I had the file in the same directory as the program, not on the jumpdrive, sorry for the confusion.
The problem still seems to be permission for the USB drive. I will talk to our IT guy in the morning.
|
|
 |