Error handling in ASP VbScript is a little primitive but effective if you know how to use it. This shows how for an Access DB with a connection string.
Code:
dim m_oConn
dim m_oConnString
set m_oConn=server.createobject("ADODB.connection")
'build your connection here
m_oConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source= " & server.mappath("/db/access.mdb")
on error resume next ' set error trapping
m_oConn.Open m_oConnString ' try to open the connection
if err.number <> 0 then
'handle the error here
' this will just print out the error description
response.write "Whoops! This happened <br>"
response.write err.description
else
response.write "Whoo Hoo!!"
end if
|