Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keep database in c:\ directory...

    Hi,
    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 OLEDBatabase Password=welcome"
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open connstring
    %>

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:\database.mdb"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •