Solved

ON ERROR GOTO

Posted on 2004-09-22
4
2,303 Views
Last Modified: 2010-07-27
Hey,

I'm having a problem with an ASP page. I am connecting to a DB, but if something happens, I want to log the error. I was tryin to use ON ERROR GOTO log_Function, but I cant seem to get this to work. Is this only for VB and not VBScript. If so, any ideas how I would solve this problem?

Cheers
0
Comment
Question by:gogul
4 Comments
 
LVL 5

Accepted Solution

by:
KarcOrigin earned 63 total points
ID: 12121081
VBScript has no On Error Goto some_handler Instead of this try doing something like this to capture your errors:
<%
On Error Resume Next

A = 10 / 0 <---------- This line contains the potential error of divisible by zero.
%>

' Check error codes after the statement executes.
<% If Err.Number <> 0 Then %>
  ' Here do your processing
0
 
LVL 5

Assisted Solution

by:aryumin
aryumin earned 62 total points
ID: 12121103
<%
On Error Resume Next
Conn.Open (...)
Set objRS = Conn.Execute (SQL_statement)
Set errors = Conn.Errors
If errors.Count > 0 Then
Response.Write "Error in SQL: " & SQL_statement
& "<br>"
For Each er In errors
Response.Write er.Source & "<br>"
Response.Write er.Description & "<br>"
Response.Write er.Number & "<br>"
Response.Write er.SQLState & "<br>"
Response.Write er.NativeError & "<br>"
Next
End If
On Error GoTo 0
%>
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now