<head>
<title>Error的对象应用示例</title>
</head>
<body>
<%
dim cnn,strsql
On Error Resume Next '错误处理方式
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.Open "Dsn=jxglwww" 
'cnn.errors.clear
dim i,errobj
if cnn.errors.count>0 then 
response.Write "系统发生"&cnn.errors.count &"个错误<br>"
For I =0 To cnn.Errors.Count-1 '循环错误对象
set errobj=cnn.errors.item(i)  '建立每个错误对象
response.Write "错误编号："&errobj.number&"<br>"
response.Write "错误描述："&errobj.description&"<br>"
response.Write "错误原因："&errobj.source&"<br>"
response.Write "错误提示："&errobj.helpcontext&"<br>"
response.Write "帮助文件："&errobj.helpfile&"<br>"
response.Write "原始错误："&errobj.nativeerror&"<br>"
next
else
response.Write "数据库连接正常，请放心使用："
end if
%>
</body>
</html>
