May 17, 2008

Physical Path To Database

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > .NET ( ASP.net VB.net )

free web hosting

Physical Path To Database

kvarnerexpress
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:
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:

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

 

 

 


Reply

magiccode9
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

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 www.abc.com/forum/admin/index.php 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). smile.gif

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

- hope this help

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. virtual path net - 6.81 hr back.
  2. virtual drive database vb.net - 18.65 hr back.
  3. the path parameter for the mappath method must be a virtual path. a physical path was used. - 27.88 hr back.
  4. the path parameter for the mappath method must be a virtual path. a physical path was used - 29.28 hr back.
Similar Topics

Keywords : physical, path, database

  1. Best Tools For Website
    Building website with database support (6)


      Looking for physical, path, database

Searching Video's for physical, path, database
advertisement



Physical Path To Database



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE