danimbrogno
asked on
File names
sorry, heres another noob question:
and i apologize if i use incorrect terminology.
on my local server ive been using a specific path name to reference my database location (i.e: C:\aspnet\database.mdb)
when i upload my website to the host how would i reference the database if it is in the same directory as the aspx file? i keep getting errors when i try to use like: /database.mdb or \database.mdb or just database.mdb
does it have something to do with server.MapPath ?? thanks a lot
'set connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.O LEDB.4.0;" & _
"Data Source= what goes here?? ")
and i apologize if i use incorrect terminology.
on my local server ive been using a specific path name to reference my database location (i.e: C:\aspnet\database.mdb)
when i upload my website to the host how would i reference the database if it is in the same directory as the aspx file? i keep getting errors when i try to use like: /database.mdb or \database.mdb or just database.mdb
does it have something to do with server.MapPath ?? thanks a lot
'set connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.O
"Data Source= what goes here?? ")
ASKER
for some reason that doesnt work... but ive solved the problem, i ended up using this code
("Provider=Microsoft.Jet.O LEDB.4.0; Data Source=" & server.mappath("products.m db"))
Ill give the points if someone knows why i needed the server.mappath deal... it stumps me
("Provider=Microsoft.Jet.O
Ill give the points if someone knows why i needed the server.mappath deal... it stumps me
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'set connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.O
"Data Source= myDatabase.mdb ")
Similarly, if it is in a subfolder of the current webfolder, you can reference it starting from the current aspx folder using backslashes *except* no backslash at the beginning:
'set connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.O
"Data Source= databases\myDayabase.mdb ")
It's when it's outside of your current web folder tree that you get in trouble.