Re: A Different ASP and Access Database Question

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Tue, 03 Oct 2000 21:55:31 -0400
 To:  hwg-techniques(at)hwg.org
 Cc:  Danny Griffin <danny(at)tillmanallengreer.com>
 References:  equilibriumdesign
  todo: View Thread, Original
At 10:18 AM 03/10/00 -0400, you wrote:
>I am also using Dreamweaver Ultradev to make my first database-driven=20
>forms.  I am using IIS on a Windows 2000 PC.  Here is my question:
>
>In setting up the database, I had to set up a connection on my PC to the=20
>database.  Otherwise I assume the javascript does not know where to look=20
>for the database.  However, I want to upload this form and the database to=
=20
>a Windows NT server running ASP.  When I do that, there won't be a=20
>connection to the database on that server?  What do I do?  Do I have to=20
>have the server's administrator set up a connection for me each=20
>time?  That would be a pain!  Is there a way to upload my connection?

yes!  Use a DSN-less connection.  With UltraDev you will have to modify the=
=20
code by hand though because it doesn't support the Server.MapPath=20
method.  The MapPath method is used because you can't know the full path to=
=20
your database on the live server.  A typical DSN-less connection would look=
=20
something like the following (I use VBScript but the JavaScript code should=
=20
be similar, watch out for wrapping, this is all on one line):

rsYour Recordset.ActiveConnection =3D "Driver=3D{Microsoft Access Driver=20
(*.mdb)}; DBQ=3D"  & Server.MapPath("..\cgi-bin\data\yourdb.mdb")

Note the relative path to the database.  The Server.MapPath method will=20
translate it to a full path on the live system so this code is portable to=
=20
any system.  I also read somewhere that apparently, DSN-less connections=20
are faster than DSN connections and you never need to ask your hosting=20
service to create DSNs for you.

HTH!

St=E9phane Bergeron

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA