Silly connection string question

Results 1 to 2 of 2

Thread: Silly connection string question

  1. #1
    Kevin Guest

    Default Silly connection string question

    I&#039m new to web development and ASP, so please be kind.<BR>I have what I hope is a very simple question about connection strings.<BR><BR>In all of the documentation I have read about using DSN-less connections, or connecting directly to the OLEDB, I noticed everyone is using an explicit path to their database (i.e.- "d:myfilessomedb.mdb"). So my question is this....<BR>How is this going to work when I publish my site to the web? I hope I didn&#039t miss something, but maybe the answer is just too obvious for anyone to have written about it. Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Silly connection string question

    Well, first off, I hope that the ISP you are uploading to allows for ASP with databases. Next, you do not have to give the filename implicitly. Instead, you may use the Server.MapPath Method. So your code would look like this:<BR><BR>strDB = Server.MapPath("somedb.mdb")<BR><BR>If your database is in a directory under the root of the website you are on, you would just need to put that in like an absolute reference in a webpage.<BR><BR>strDB = Server.MapPath("/cgi-bin/somedb.mdb")<BR><BR>Hope this helps.

Posting Permissions

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