473,320 Members | 1,952 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,320 software developers and data experts.

ASP will still execute code after run-time error has detected?

The following code has run-time error on "divide by 0" error. I expect
"do the work<br>" will not print in the browser, since it happen after
the code
that cause the error. However, this is the output: any ideas why?? Or
this is the nature of ASP scripting language that is being executed in
sequential order? Please advice. thanks!!

//////// output ///////////////////////////

before error
do the work
Division by zero
after error handling

/////////// code ///////////////////////////
<%
On Error Resume Next
Response.write "before error<br>"
dblValue = 1/aa '== Will cause a divide by 0 error

Response.Write "do the work<br>"

If Err.Number <0 Then
Response.write Err.Description & "<br>"
End If

Response.Write "after error handling<br>"
%>

////////////////////////////////////////////

Jul 13 '06 #1
1 1358

John wrote:
The following code has run-time error on "divide by 0" error. I expect
"do the work<br>" will not print in the browser, since it happen after
the code
that cause the error. However, this is the output: any ideas why?? Or
this is the nature of ASP scripting language that is being executed in
sequential order? Please advice. thanks!!

//////// output ///////////////////////////

before error
do the work
Division by zero
after error handling

/////////// code ///////////////////////////
<%
On Error Resume Next
Response.write "before error<br>"
dblValue = 1/aa '== Will cause a divide by 0 error

Response.Write "do the work<br>"

If Err.Number <0 Then
Response.write Err.Description & "<br>"
End If

Response.Write "after error handling<br>"
%>

////////////////////////////////////////////
'On Error Resume Next' tells the compiler to ignore any runtime errors
and resume with the next line of code. Details of the (last) error are
stored in the Err Object. Without 'On Error Resume Next', the compiler
would halt processing this script at the point it encounters a divide
by zero error (or indeed any runtime error).

--
Mike Brind

Jul 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Luis | last post by:
In the code below I have a Response.End in the middle of a Do loop that is run if the condition in a nested 'If...' statement is not met. Will the rs and conn objects be closed and destroyed if the...
11
by: penguinman | last post by:
I type ./a.out and the shell just sits there. It doesnt hang it just sits there looking pretty. I run the program with the ddd option and executed it from ddd...execution window comes up and...
3
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone...
3
by: Me | last post by:
hi, I have this file I need to execute from an ASP client. since we have installed it on the SQL Database server machine, I thought I could run it like this: Set Cn =...
6
by: Geir Baardsen | last post by:
Hi! This is a routine for copying a recordset into a new order. It has worked fine under Win98. However, my client has changed to Win XP, and suddenly it doesn't work anymore. I keep getting the...
11
by: ricolee99 | last post by:
Hi everyone, I'm trying to invoke my .exe application from a remote server. Here is the code: ManagementClass processClass = new ManagementClass ("\\\\" +"RemoteServerName" +...
6
by: Jeff Johnson [MVP: VB] | last post by:
My testing seems to indicate that it won't, but no documentation I can find explicitly states this. Let's say I throw a customer exception like this: Try m = New MyObject Catch ex As Exception...
0
by: franjorge | last post by:
Hi, I have created two stored procedures via VB using this code: sql = "CREATE PROC " & nombre_proc & " AS SELECT *" & _ " From MBM_PUNTOS_SCE_SIN_COINCIDIR_SIEGE_FALTA_PM_NE_" & mes & _ "...
17
by: Ravi | last post by:
void main() { main(); } int main() { main(); }
19
by: citronelu | last post by:
Is it possible to execute a binary string stored within a python script as executable code ? The script is run under Windows, and the binary code (a full executable file) is stored in a variable...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.