开发者

Classic ASP Connection

开发者 https://www.devze.com 2023-01-04 13:00 出处:网络
In my asp project,i have two databases开发者_开发技巧 in MS Access.Below code is working fine.But I need to add one more database with another dsn name.I have created dsn name efg and done the ODBC Co

In my asp project,i have two databases开发者_开发技巧 in MS Access.Below code is working fine.But I need to add one more database with another dsn name.I have created dsn name efg and done the ODBC Connection for new databse in the control panel->Administrative tools.How can add the newly added dsn to the below code.

<%
 session("connectionstring") = "dsn=abc"
 set objconn = server.CreateObject("adodb.connection")
 objconn.open session("connectionstring")
%>


Just create a second connection for the second dsn:

<%
 ' First dsn/connection
 session("connectionstring") = "dsn=abc"
 set objconn = server.CreateObject("adodb.connection")
 objconn.open session("connectionstring")

 ' Second dsn/connection
 session("connectionstring2") = "dsn=newDSN"
 set objconn2 = server.CreateObject("adodb.connection")
 objconn2.open session("connectionstring2")
%>
0

精彩评论

暂无评论...
验证码 换一张
取 消