Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ON ERROR GOTO

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

792 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