:
: 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.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp