Connecting to my Database....

This is a discussion on "Connecting to my Database...." within the Classic ASP section. This forum, and the thread "Connecting to my Database.... are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Jan 16th, 2004, 07:37
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
Connecting to my Database....

OK, I can connect to my database no problems as long as its in the WWW folder.. How do I link it to my db folder instead of my WWW???

heres what I am using now!


strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Database.mdb")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Jan 16th, 2004, 08:23
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
MapPath takes a virtual location and changes it to a absolute location. So, if your db folder is on the same level as your www folder you'd do MapPath("../db/database.mdb"), if it's in a subfolder then MapPath("db/database.mdb"). Or of course if you know the absolute location you can just put that in "...Data Source=e:\inetpub\db\database.mdb" or whatever.

The only problem with MapPath is if you use it in an include file that's called from files in different levels of directories, then the relative location of the database to the file won't be the same for them all and you'll get errors. If that doesn't make sense ignore it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Jan 16th, 2004, 09:03
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
hrmm... Tried the virtual location thing, I have to go up 2 folders to get back to the db folder. Also, it gave me an error when I typed the ../ part. Said the .'s arent allowed. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Jan 16th, 2004, 09:11
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
does your host allow you to setup a DSN? if so the code just changes to:

strConnString = "DSN=<dsn-name>"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
connecting, database

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting to database franknu PHP Forum 4 Jul 23rd, 2006 08:39
connecting to CSV file madhuri.t Classic ASP 0 Jul 10th, 2006 13:50
connecting to CSV file madhuri.t Classic ASP 1 Jul 8th, 2006 09:36
problems connecting to database benbacardi Classic ASP 8 Apr 15th, 2005 16:16
connecting to web-email via pop using php... Billydakid PHP Forum 7 Feb 12th, 2004 08:42


All times are GMT. The time now is 11:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42