简体   繁体   中英

Connecting Classic ASP to SQL Server 2012

I have 2 servers, a win2000+ Classic ASP application server, the other is Server 2012 with a SQL 2012 instance.

On the application server I can create an ODBC DSN (name is "test") to connect to the SQL instance, and access database (mdb). I use "test" to link tables in B, so the connection is fine. But on my ASP page I cannot connect to the SQL instance, and an error message is displayed: "SQL Server does not exist or access denied".

Here's my code:

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DSN=test;UID=user;PWD=pwd;DATABASE=test"
conn.close
set conn = nothing
response.write "ok"

Try this?

Dim MM_MyServer_STRING

MM_MyServer_STRING = "SERVER=test;DATABASE=test;user id=user;password=pwd"

Set ConnectMe = Server.CreateObject("ADODB.Recordset")
ConnectMe.ActiveConnection = MM_MyServer_STRING

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM