469,270 Members | 1,011 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Microsoft VBScript compilation (0x800A0400): Expected statement

When the ASP statement end with a _ character, then the next line cannot
have comment ' character. Is that correct? Since I encountered the following
error:

Microsoft VBScript compilation (0x800A0400)
Expected statement

sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _
' & 2 & "," _
& beginhour & "," _
& tohour & ");"

Jul 19 '05 #1
3 16770
Did you copy and paste that code? It shouldn't give that error. The next
line can start with a ', but all the lines that follow it with the _
character will be a continuation of the comment, not code.

Ray at home

"Matt" <ma*******@hotmail.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
When the ASP statement end with a _ character, then the next line cannot
have comment ' character. Is that correct? Since I encountered the following error:

Microsoft VBScript compilation (0x800A0400)
Expected statement

sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _ ' & 2 & "," _
& beginhour & "," _
& tohour & ");"


Jul 19 '05 #2
"Matt" wrote:
: When the ASP statement end with a _ character, then the next line cannot
: have comment ' character. Is that correct? Since I encountered the
following
: error:
:
: Microsoft VBScript compilation (0x800A0400)
: Expected statement
:
: sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES ("
_
: ' & 2 & "," _
: & beginhour & "," _
: & tohour & ");"

It is an append to the next line.

good:
Response.Write("First line<br />" & vbCrLf & _
"Second line<br />" & vbCrLf)
result:
First line
Second line

bad:
Response.Write("First line<br />" & vbCrLf _
Response.Write("Second line<br /> & vbCrLf)
result:
Microsoft VBScript compilation error '800a03ee'
Expected ')'
Response.Write("Second line<br />" & vbCrLf)
--------------------------------------------^

This will give you an error because it says you need a closing ).
So, if you change it to this:
Response.Write("First line<br />" & vbCrLf _
Response.Write("Second line<br /> & vbCrLf))

You'll get an interesting result:
Second line
First line

If you're going to append lines, then it should follow as you would write it
on one line. Your SQL statement is not finished and you cannot put a
comment in the middle of it.

This also is incorrect.

sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _
' & 2 & "," _
& beginhour & "," _
& tohour & ");"

The thing to do it comment out the whole statement and just use a new
statement with the part you want to remove.
'sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _
' & 2 & "," _
' & beginhour & "," _
' & tohour & ");"

sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _
& beginhour & "," _
& tohour & ");"

The only thing wrong now is you need to remove Weekday since you have 3
columns and only 2 values. (O:=
And, it should probably be more like this:

sqlStmt = "INSERT INTO TimeSlot(BeginTime, EndTime) VALUES(" _
& beginhour & ", " _
& tohour & ")"

If the values were strings '12PM' instead of numbers '12', then you'll want
quotes around the values:

sqlStmt = "INSERT INTO TimeSlot(BeginTime, EndTime) VALUES('" _
& beginhour & "', "' _
& tohour & "')"

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default...&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/tre...er/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp

Jul 19 '05 #3
I think the issue here is that because the second line is commented, the
'_' continuation for the third line is not seen. It's just part of the
second line's comment!

-rwg

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Matthew Louden | last post: by
1 post views Thread by JNariss | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.