&
<% on error resume next Set Conn = Server.CreateObject("ADODB.Connection") my_DSN="DSN=student;uid=student;password=magic2" conn.open my_DSN Call CheckOpen Conn.Close set conn=nothing SUB CheckOpen If err.number>0 then%>VBScript Errors Occured:
Error Number=<%=err.number%>
Error Descr.=<%=err.description%>
Help Context=<%=err.helpcontext%>
Help Path=<%=err.helppath%>
Native Error=<%=err.nativeerror%>
Source=<%=err.source%>
SQLState=<%=err.sqlstate%>
<%else%> No VBScript problems occured!
<%end if
IF conn.errors.count> 0 then%> ADO Reports these Database Error(s):
<%
maxerrors=conn.errors.count-1
for counter= 0 to maxerrors
DBErrorNum=conn.errors(counter).number
DBErrorDesc=conn.errors(counter).description
SELECT CASE DBErrorNum
CASE -2147467259
response.write "Problem => Bad DSN
"
response.write "DSN => " & my_DSN & "
"
CASE -2147217843
response.write "Problem => Bad Login Info
"
response.write "DSN => " & my_DSN & "
"
exit sub
CASE ELSE%>Error # = <%=DBErrorNum%>
Error description = <%=DBerrorDesc%>
<%END SELECT next else%> Everything Went Fine <% end if END SUB%>