Server.MapPath

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
Does anyone know if i can use Server.MapPath in my Vb.net app. Or an alternative to it
VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] conn [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=/bin/location.mdb"[/size]
[size=2]
[/size]
As you can see from the above code I have a database in the bin directory of my app. When I run this piece of code though it looks to this location c:\bin\location.mdb. Which is incorrect

Can anyone help, very urgent.
 
You'll need to pass your connection the full path. You can use :
...Data Source=" & application.startuppath & "/bin/location.mdb"

Hope that helps

TPM
 
Back
Top