代码如下:-------------------------------------------------------On Error Resume Next Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open Connstr If Err ThenErr.ClearSet Conn = NothingResponse.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"Response.End End If------------------Err使系统自定义的不用自己定义,你把下面的代码加行就可以了-----------------------------------
If Err ThenErr.ClearSet Conn = NothingResponse.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"Response.End
End If参考资料:http://hi.baidu.com/maoniu_1