|
 |
asp_databases thread: Beginner Question - Referencing Data Base
Message #1 by sg48@y... on Wed, 30 May 2001 14:54:27
|
|
How do I reference my database after I ftp transfer my files to a remote
server. Right now I am doing all my development on my local machine and
everything works fine. Right now I have hardcoded the path to the database
as C:\Databases etc. similar to the method shown in Chapter 15 of Beginning
ASP 3. I don't see how this will work when I try to publish the
application. Thanks in advance - Steve
Message #2 by "shane conrow" <shane_conrow@h...> on Wed, 30 May 2001 16:59:14
|
|
The best way would be to make a DSN on both your local machine and on the
server. That way, when you work on your machine the DSN will reference
the location of the local database, and when you move to the server it
will reference the location of the production database without having to
change a single line of your code. Use a line such as:
oConn.Open "FILEDSN=databasename"
to connect in your code.
Message #3 by "Daniel O'Dorisio" <dodorisio@h...> on Wed, 30 May 2001 13:31:16 -0400
|
|
actually the best way would probally be to use an OLE DB Connection String.
do something like:
path = Server.MapPath("db/my.mdb")
connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & path &
";User ID=uid;Password=pwd;
ssql = "SELECT bla FROM bla"
objrs.open ssql, connstring, <ursortype>, <lock type>
then on both the server and your dev computer store the db under the /db
folder of the root web.
daniel
p.s. i think that connstring is correct.. i always forget how they go:-)
Daniel O'Dorisio
dodorisio@h...
xxx-xxx-xxxx
-----Original Message-----
From: shane conrow [mailto:shane_conrow@h...]
Sent: Wednesday, May 30, 2001 4:59 PM
To: ASP Databases
Subject: [asp_databases] Re: Beginner Question - Referencing Data Base
The best way would be to make a DSN on both your local machine and on the
server. That way, when you work on your machine the DSN will reference
the location of the local database, and when you move to the server it
will reference the location of the production database without having to
change a single line of your code. Use a line such as:
oConn.Open "FILEDSN=databasename"
to connect in your code.
|
|
 |