Solved

ON ERROR GOTO

Posted on 2004-09-22
4
2,311 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
[X]
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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

615 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