By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

Microsoft VBScript compilation (0x800A0400): Expected statement

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
"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

P: n/a
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.