For Programmers: Free Programming Magazines  


Home > Archive > ASP > December 2004 > Database Connectivity









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Database Connectivity
MROPARTNER@comcast.net

2004-12-27, 8:55 pm

Microsoft has a tutorial for ASP. There is a connection string in the
code
as follows:

DBQ=C:\Inetpub\Wwwroot\Tutorial\guestboo
k.mdb;"\

How do I change this statement once I move the page to my web server?
I
have the database in my root folder.


Thanks

Ray Costanzo [MVP]

2004-12-27, 8:55 pm

Try using this, both locally and remotely:

Dim sConnectionString
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/tutorial/guestbook.mdb")

Note that unless you've configured IIS so that read-access is denied to that
file or directory via HTTP, anyone in the world can download your database.
(Assuming that directory is a WWW-published directory.)

Ray at work


<MROPARTNER@comcast.net> wrote in message
news:1104181530.101426.202050@z14g2000cwz.googlegroups.com...
> Microsoft has a tutorial for ASP. There is a connection string in the
> code
> as follows:
>
> DBQ=C:\Inetpub\Wwwroot\Tutorial\guestboo
k.mdb;"\
>
> How do I change this statement once I move the page to my web server?
> I
> have the database in my root folder.
>
>
> Thanks
>



Jeff Cochran

2004-12-27, 8:55 pm

On Mon, 27 Dec 2004 16:11:54 -0500, "Ray Costanzo [MVP]" <my first
name at lane 34 dot commercial> wrote:

>Try using this, both locally and remotely:
>
>Dim sConnectionString
>sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
>Server.MapPath("/tutorial/guestbook.mdb")


As an explanation, Server.MapPath finds the actual physical path on
the system to the file beginning at the root of the web. So if your
file was physically at:

c:\inetpub\wwwroot\subfolder1\applicatio
n\database.mdb

and your site's root was at:

c:\inetpub\wwwroot\

then the MapPath argument would be:

("/subfolder1/application/database.mdb")

Using MapPath ensure that the structure of your web site is followed,
no matter where the root of your site happens to be on the server.
Your ISP could have your root at H:\Webroots\BasicHostingPlans\Bob\
and as long as your structure of your site is the same as on your
home/development system you don't need to change the code.

Jeff


>Note that unless you've configured IIS so that read-access is denied to that
>file or directory via HTTP, anyone in the world can download your database.
>(Assuming that directory is a WWW-published directory.)
>
>Ray at work
>
>
><MROPARTNER@comcast.net> wrote in message
>news:1104181530.101426.202050@z14g2000cwz.googlegroups.com...
>


MROPARTNER@comcast.net

2004-12-28, 3:55 am

Jeff,

Do you offer consulting (tech support) by the hour? If so what is your
fee?

Thanks

Jeff Cochran

2004-12-29, 3:55 am

On 27 Dec 2004 18:06:00 -0800, MROPARTNER@comcast.net wrote:

>Do you offer consulting (tech support) by the hour? If so what is your
>fee?


Contact me via email at:

jeff at zina dot com

Jeff
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com