我有一个经典ASP的网络应用程序,大多数时候都运行。问题是有时我们的互联网连接很糟糕。如果Web应用程序无法连接到SQL Server,我想将其保存在本地服务器上。所以我的问题是:
如何使用经典ASP检查与外部SQL Server的连接是否存在?
答案 0 :(得分:3)
<%
set conn = CreateObject("ADODB.Connection")
on error resume next
conn.open "remote connection string"
if err.number <> 0 then
response.write "unable to connect, trying other"
conn.open "alternate connection string"
end if
on error goto 0
%>