Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ON ERROR GOTO

Posted on 2004-09-22
4
Medium Priority
?
2,314 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 252 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 248 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month12 days, 8 hours left to enroll

972 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