Jump to content
xisto Community
kvarnerexpress

Physical Path To Database

Recommended Posts

I'm trying to learn asp using vbscript and am specifically trying to connect to a database.

I am getting the following error from the following code:

Quote:

Server.MapPath(), ASP 0172 (0x80004005)The Path parameter for the MapPath method must be a virtual path. A physical path was used.
/html/objconn.asp, line 11



The code is as follows.

Code:

set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("C:\Documents and Settings\jk\My Documents\testdb.mdb"))set rs = Server.CreateObject("ADODB.recordset")rs.Open "SELECT Companyname, Contactname FROM Customers", conn



Would very much appreciate any help as to where i'm going wrong here. Many Thanks,kvarnerexpress

Share this post


Link to post
Share on other sites

Server.MapPath(), ASP 0172 (0x80004005)

The Path parameter for the MapPath method must be a virtual path. A physical path was used.

/html/objconn.asp, line 11

as you can see, the error message stated that you should provide a virtual path instead of physical path, so, in this case:

 

virtual path means the url address exclude the domain name parts, for instance, the url of http://forums.xisto.com/no_longer_exists/ would be /forum/admin.

physical path means from local drive name + path to resourse data, for instance, as your code written in above post.

since then, have a change the Server.MapPath(physical path) statement to Server.MapPath(virtual path). :)

 

P.S. FYI, virtual path you provides can be relative virtual path. and you go here to learn more.

 

- hope this help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.