View Full Version : Keep database in c:\ directory...

03-20-2006, 02:31 PM
Is it possible to keep my database file (access db) in local pc (C drive)?
I have created all the page with asp, the reason is that I cannot set the server path to write on the database if it's save under server.
I am only running all this file in one pc. how can I change below statement if I want the db file save in the local c:...Tks
<%Dim DBPath, connstring, conn
DBPath = "score.mdb"
connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & server.mappath(DBPath) & ";" & "Jet OLEDB:Database Password=welcome"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstring

03-20-2006, 05:16 PM
You cannot use Server.MapPath to reference a file out of the webroot, well not without a bit of fiddling.

It's best to use the absolute path if they are saved in C.
Also note that you will have to allow permissions for the files.