473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

script for on error goto errhandler

is't asp supported for on error goto error handler?
if so can anybody give me some hint for it...
i need to make my page get to other link if detecting an error
Nov 5 '08 #1
3 10995
DrBunchman
979 Expert 512MB
Hi MATTXtwo,

The first thing to do is to put the following line at the top of your page:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. On Error Resume Next
  3. %>
This tells the interpreter to ignore any errors and carry on processing the script. The next thing you need is a bit of code to trap any errors which occur:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. If Not Err.Number = 0 Then
  3. Response.Write Err.Description
  4. Error.Clear
  5. End If
  6. %>
You can put whatever you like in this second bit of code to handle the error as required.

Hope this helps and let me know how you get on,

Dr B
Nov 5 '08 #2
Expand|Select|Wrap|Line Numbers
  1. <%
  2. On Error Resume Next
  3. %>
Expand|Select|Wrap|Line Numbers
  1. <%
  2. If Not Err.Number = 0 Then
  3. Response.Write Err.Description
  4. Error.Clear
  5. End If
  6. %>
Thanks DrB ...
Can I do like this..
ON ERROR code top of page
iif statement bottom of page?
and can this code catch all error on pages?
Nov 5 '08 #3
DrBunchman
979 Expert 512MB
Yes, that's how it should work.

Give it a go and let me know what happens. You should be able to force your page to error quite easily so you can test it.

Dr B
Nov 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Geoff Turner | last post by:
Morning all, Below is a piece of code to deal with a deliberate error. Can someboby explain why, in run mode, 'errhandler' is not reached, but the error is caught by the standard error handler,...
11
by: ColdCanuck | last post by:
Greetings! I am VERY new to DB2 but not Orable, Sybase and SQL Server. I am trying to call a stored procedure via VB 6 and ADO/OLEDB. But when I try to execute
2
by: Tony | last post by:
Access collective, I am running WinNT4.0, Acc2000 SR1 and IE 6.0. I converted (from Acc97) and imported Dev Ashish's InetTransferLib add-in modules into my Acc2000 database. Using the sample FTP...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
4
by: sm | last post by:
Hi, I have a couple of questions with regards to handling errors and exceptions. 1. If I use On Error goto Errhandler ... Errhandler:
1
by: Bruce | last post by:
Hello, I know this must be something simple I'm overlooking but I can't get err.raise inside a class to return anything but 440 - automation error. For example, if I create the following test...
2
by: christianlott1 | last post by:
I'm doing a replace function on a phone number field: Expr1: NZ(ReplaceText(),"") and it converts most of them but for others I get this "#Error" in the fields. Since I will need to do a join...
3
by: alnug | last post by:
Hello, I'm trying to use the following code to read data from Excel files and put the data into an MS Access Table. Some of the Excel files have the tabs in the sequence Chart1, Sheet1, Sheet2 etc...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.