server.mappath

mazlina

Member
Joined
Aug 25, 2003
Messages
13
Location
malaysia
below is my connection string.............

myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Server.MapPath/AttendanceReport.mdb;")

ive got this error.............

C:\WINNT\system32\Server.MapPath\AttendanceReport.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.

which means that it read the wrong path of my database. how can i make changes of my server.mappath so that it read C:\Inetpub\wwwroot.........
 
Server.MapPath is a variable and shouldnt be part of the string.

Try:

Code:
myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath & "/AttendanceReport.mdb;")
 
i still got this error msg....

Format of the initialization string does not conform to specification starting at index 88.

Line 63: myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= & Server.MapPath & /AttendanceReport.mdb;")
 
Sorry mate, its been a while since Ive done anything in asp.

The connection string is more like this:

Code:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("dbfolder/AttendanceReport.mdb")

The hard bit is finding out the path to your database. If the dbfolder is a sub folder of wwwroot, then you can use ../dbfolder/AttendanceReport.mdb etc.
Its going to be a bit of trial and error, but if you post some more information about the folder structure, then it will be easier for us.
 
Back
Top