ASP with MS SQL Server...

ASP with MS SQL Server...

Post by Vitor Varalong » Fri, 18 Sep 1998 04:00:00



    Hi!!

    I am currently working on some Active Server Pages,
working on an Access Database, but since this is going
suppose to be on-line I had to abandon Access in order
to work with MS SQL Server.
My question is the following:

When I worked with the Access database which was stored
in the same machine as the ASPs, I used the following
code to establish the connection with the database:

Set conntemp = Server.CreateObject("adodb.connection")
cnpath = "DBQ=" & Server.MapPath("telefones.mdb")
conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath

How can I change this in order to connect to the dabatase
which is now running within SQL Server which is in another machine?
(Suppose that the database name is "Telefones", the
login/password is "user"/"readonly" and the System DSN is
"TelefoneDB")


Thanks in advance,

Vitor Varalonga

 
 
 

ASP with MS SQL Server...

Post by James O'Reill » Fri, 18 Sep 1998 04:00:00


Set conn = Server.CreateObject("ADODB.Connection")
conn.open "TelefoneDB","user","readonly"

you can use this for any DSN  whether it's SQL or ACCESS.
The actual database name is stored in the DSN so you don't need to worry
about specifying "Telefones" in the ASP.

James

Quote:

>Set conntemp = Server.CreateObject("adodb.connection")
>cnpath = "DBQ=" & Server.MapPath("telefones.mdb")
>conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath

>How can I change this in order to connect to the dabatase
>which is now running within SQL Server which is in another machine?
>(Suppose that the database name is "Telefones", the
>login/password is "user"/"readonly" and the System DSN is
>"TelefoneDB")