Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange error "Expected end of statement" 1

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
US
I routinely put the following code at the end of an asp page.
cnn is the connection object
Code:
	<%
	on error resume next
	cnn.close
	set cnn=nothing
	
	 %>

But today I got this strange error in a new page.

Code:
Microsoft VBScript compilation  error '800a0401'

Expected end of statement

/projects_test.asp, line 279

on error resume next		cnn.close	set cnn=nothing
----------------------^

The page worked fine after I disabled the line of code "on error resume next".

By the way, that page works fine on the IIS7 that runs on my laptop. The production server is IIS 6.0. This information may be irrelevant because so many other pages on the IIS6 server have the same code.

Any idea?
 
My guess would be that is has nothing to do with the posted code snippet and is the reult of an unclosed IF or something similiar in the code of projects_test.asp.

I would look to the code of that page.
 
Good thinking. Thanks.

I checked my code but there is no such error. In fact, there is no logical operator in that page.
 
What strikes me odd is that all three of your commands are displayed in one line!
How come?
They need to be on three distinct lines separated by either cr+lf or ";"
Check that out.

Cheers,
MiS

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
MakeItSo,

You are right to the point.

My code in the visual studio 2005 is clearly in three lines, even separated by a blank line. Believe me I have typed line break.

When I copied the code to a notepad, all code was in one line. I could not believe it. Anyway, I deleted the block of code and retyped the same code, and copied it to the notepad to make sure it is in three lines.

This time everything worked.

I guess something was wrong with my VS IDE.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top