Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBScript - On Error GoTo - displays Syntax Error

Posted on 2002-03-19
7
Medium Priority
?
1,892 Views
Last Modified: 2007-12-19
I have this ASP page where I have an

<%
On Error GoTo ProcError

ASP code goes here....

ProcError:
  Session("objConn").RollbackTrans
  Session("objConn").Close
%>

Everytime I view this page in a browser, I get this error:

      VBScript error - Syntax Error on line 1

Line 1 pertains to the 'On Error GoTo ProcError'

I could not decipher why this is happening.  Thank you for your help.


0
Comment
Question by:gflorentin
[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
  • 2
7 Comments
 
LVL 18

Expert Comment

by:mdougan
ID: 6880375
My first guess would be that you could only use a lable, such as ProcError:  inside of a public sub or function. (that is, if you can use lables in ASP at all... you might try:

<%
Public Sub DoIt()
On Error GoTo ProcError

ASP code goes here....

ProcError:
 Session("objConn").RollbackTrans
 Session("objConn").Close
End Sub

DoIt

%>
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6880377
My first guess would be that you could only use a lable, such as ProcError:  inside of a public sub or function. (that is, if you can use lables in ASP at all... you might try:

(opps, forgot the Exit Sub, this may post twice)

<%
Public Sub DoIt()
On Error GoTo ProcError

ASP code goes here....

 Exit Sub
ProcError:
 Session("objConn").RollbackTrans
 Session("objConn").Close
End Sub

DoIt

%>
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6880387
My first guess would be that you could only use a lable, such as ProcError:  inside of a public sub or function. (that is, if you can use lables in ASP at all... you might try:

(opps, forgot the Exit Sub, this may post twice)

<%
Public Sub DoIt()
On Error GoTo ProcError

ASP code goes here....

 Exit Sub
ProcError:
 Session("objConn").RollbackTrans
 Session("objConn").Close
End Sub

DoIt

%>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Expert Comment

by:mdougan
ID: 6880389
My first guess would be that you could only use a lable, such as ProcError:  inside of a public sub or function. (that is, if you can use lables in ASP at all... you might try:

(opps, forgot the Exit Sub, this may post twice)

<%
Public Sub DoIt()
On Error GoTo ProcError

ASP code goes here....

 Exit Sub
ProcError:
 Session("objConn").RollbackTrans
 Session("objConn").Close
End Sub

DoIt

%>
0
 
LVL 2

Accepted Solution

by:
damienm earned 300 total points
ID: 6880396
You cannot use on error goto in ASP, only resume next.
0
 
LVL 2

Expert Comment

by:damienm
ID: 6880398
then use

if err.value <> 0 then
  response.write err.description
  response.end
end if
0
 

Author Comment

by:gflorentin
ID: 6880771
I tried that and the syntax error went away.  Thank you.

However, whenever I encounter an error, the check for the error.value does not work; for some reason, I am not capturing the error.  I found this out when I put a display of the error code - it skipped the check for error value because the error code did not get displayed.

I will have to try something else.
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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 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