Access database location.

Michaelk

Well-known member
Joined
Jun 3, 2004
Messages
58
Location
Australia
Programming Experience
3-5
Hi, i'm developing an ASP site using an Access database. But I think i've got a small problem.
Currently the database is located here:
VB.NET:
Data Source=C:\ASPWeb\Database\Internet.mdb"

The problem is, if i move the folder ("C:\ASPWeb") to another location, or rename the folder, the page runs into an error looking for the database "Can't find it."

I'm worried that when I upload the site to my host, the pages won't know where to find the database. Is there a way around this? Some sort of code to use instead of the one i'm using?

Thanks,
 
Server.MapPath?

Can't you just use
Data Source=" & Server.MapPath("Internet.mdb") & ";" instead? or if you can make a page on your server with:​
Response.Write(Server.MapPath(".")) and use the path it returns?​
 
I use this
VB.NET:
Dim details As OleDbConnection
 
details = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/details.mdb"))
 
Back
Top