Help with Server.MapPath

Hi guys,

I'm trying to move an Access database to a new server because the old server belongs to another company we're no longer affiliated with.

Database is in my private folder on webserver.

private/database/mygreystone.mdb

Connection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Server.MapPath("/private/database/mygreystone.mdb")"

Is this Server.MapPath call right?

Thanks
shoshe933Asked:
Who is Participating?
 
sybeCommented:
Usually one would ask for the path of a virtual directory and from there on build the path.

So if your application is running at "http://localhost/mytestweb", it would be

<%
sPath = Server.MapPath("/mytestweb") & "/private/database/mygreystone.mdb")

' connection string would then be
sDSN = "provider=Microsoft.jet.oledb.4.0; data source = " & sPath

'open a connection with the connection string
oConnection.Open sDSN

%>

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.