Discussion Locked

Connecting to a database remotely

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi! I have my ASP pages on one server and my database on another server. Using ASP ADO Connections or any other way you can recommend....how do I connect to the database? I would prefer using ASP. I do not any control over the two servers...they are just two server provided by two different ISP's. It would be great to have the code for a database connection USING DSN.

Thanks.

5 replies

by wjhunt

This code I use to connect to SQL Server:
dim strConnect
dim ssrvr

ssrvr="Driver={SQL Server};Server=(local);Database=Northwind;DSN=LocalServer;"
set oConn=createObject("ADODB.Connection")

oConn.open ssrvr

strConnect = "Select * from Employees order by LastName"

set oProp = oConn.execute(strConnect)

document.write "

"
while not oProp.eof
document.write "

"
oProp.Movenext
wend
document.write "

" & oProp("EmployeeId") & " " & oProp("LastName") & " " & oProp("FirstName") & " " & oProp("Notes") & "

"

oConn.close

This discussion is closed to new replies.