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,
 

timgaunt

New member
Joined
Aug 3, 2004
Messages
1
Programming Experience
10+
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?​
 

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
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"))
 
Top Bottom