Solved

ON ERROR GOTO

Posted on 2004-09-22
4
2,307 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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