database problems

knutlig

New member
Joined
Nov 21, 2004
Messages
2
Programming Experience
1-3
Hi...This works when i run it on my iis server "Data Source=c:\inetpub\wwwroot\johannes\news.mdb"

When i put it on my server i get this error message: 'c:\db\news.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides

I have changed the path to Data Source=news.mdb since the mdb file is in the same folder as the file that acces the database, but something is wrong. I know i need to write something else that "Data Source" but i dont konw what. Can someone help me please

Cheers Knut
 

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,462
Programming Experience
10+
You'll need to use the Server.MapPath() method to pass in the proper location on the server if not specified correctly in code or your configuration.
 

knutlig

New member
Joined
Nov 21, 2004
Messages
2
Programming Experience
1-3
how does the Server.MapPath() work?

Im wondering how to write the connectionpath using the Server.MapPath() function...

Cheers
 

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
Just like this
VB.NET:
Dim details As OleDbConnection
details = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/details.mdb"))
 
Top