开发者

Check if connection to SQL Server is available with classic ASP

I have a web app in classic ASP that most run at all times. The problem is that sometimes our internet connection is bad. If the web app can't connect to SQL Server I want to save it on a local server instead. So my question is:

How can I with classic ASP check if a开发者_Go百科 connection to an external SQL Server is live?


<%
    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
%>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜