I am new to ASP and am getting this error when i try to run the page
below. Any assistance would be most welcome.

Thanks

Nick Truscott
----------------------------

Microsoft VBScript compilation error '800a03ea'

Syntax error

/njtruscott/check_message.asp, line 30

Else
^
-----------------------------

<%

message_from = Replace(Request("from"), "'", "''")
message_subject = Replace(Request("subject"), "'", "''")
message_body = Replace(Request("message"), "'", "''")
message_from = Replace(message_from, "<", "&#60;")
message_subject = Replace(message_subject, "<", "&#60;")
message_body = Replace(message_body, "<", "&#60;")
message_type = Request("message_type")
message_parent = Request("parent_id")

If Len(message_subject) > 200 Then Response.Write("The subject is too
long.")
Response.End
End If

If message_subject = "" Then Response.Write("You have not entered a
subject.")
Response.End
End If

If message_body = "" Then Response.Write("You have not entered a
message")
Response.End

End If

Set Con = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" &
Server.MapPath("\---------\db\**********.mdb") & ";" & _
"Persist Security Info=False"
Con.Open(sConnection)

query = "INSERT INTO messages (message_type, message_from,
message_subject, message_body, "

If message_type = "thread" Then query = query & "message_forum)"
Else
query = query & "message_thread)"
End If

query = query & " VALUES ('" & Ucase(message_type) & "', '" &
message_from & "', '" & message_subject & "', '" & message_body & "'"
& ", " & message-parent & ")"

Con.Execute query

Con.Close
Set Con = Nothing

If message_type = "thread" Then Response.Redirect
"view_forum.asp?id="&message_parent
Else
Response.Redirect "view_message.asp?id="&message_parent
End If

%>

Re: Help with ASP Webpage by McKirahan

McKirahan
Sat Dec 27 15:38:23 CST 2003

"Nick Truscott" <njtruscott@btinternet.com> wrote in message
news:5cda122.0312271251.606194f3@posting.google.com...
> I am new to ASP and am getting this error when i try to run the page
> below. Any assistance would be most welcome.
>
> Thanks
>
> Nick Truscott
> ----------------------------
>
> Microsoft VBScript compilation error '800a03ea'
>
> Syntax error
>
> /njtruscott/check_message.asp, line 30
>
> Else
> ^
> -----------------------------
>
> <%
>
> message_from = Replace(Request("from"), "'", "''")
> message_subject = Replace(Request("subject"), "'", "''")
> message_body = Replace(Request("message"), "'", "''")
> message_from = Replace(message_from, "<", "&#60;")
> message_subject = Replace(message_subject, "<", "&#60;")
> message_body = Replace(message_body, "<", "&#60;")
> message_type = Request("message_type")
> message_parent = Request("parent_id")
>
> If Len(message_subject) > 200 Then Response.Write("The subject is too
> long.")
> Response.End
> End If
>
> If message_subject = "" Then Response.Write("You have not entered a
> subject.")
> Response.End
> End If
>
> If message_body = "" Then Response.Write("You have not entered a
> message")
> Response.End
>
> End If
>
> Set Con = Server.CreateObject("ADODB.Connection")
> sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" &
> Server.MapPath("\---------\db\**********.mdb") & ";" & _
> "Persist Security Info=False"
> Con.Open(sConnection)
>
> query = "INSERT INTO messages (message_type, message_from,
> message_subject, message_body, "
>
> If message_type = "thread" Then query = query & "message_forum)"
> Else
> query = query & "message_thread)"
> End If
>
> query = query & " VALUES ('" & Ucase(message_type) & "', '" &
> message_from & "', '" & message_subject & "', '" & message_body & "'"
> & ", " & message-parent & ")"
>
> Con.Execute query
>
> Con.Close
> Set Con = Nothing
>
> If message_type = "thread" Then Response.Redirect
> "view_forum.asp?id="&message_parent
> Else
> Response.Redirect "view_message.asp?id="&message_parent
> End If
>
> %>

"If anything other than a comment appears after Then on the same line, the
statement is treated as a single-line If statement."

Try restructuring your code to conform with:

If {test} Then
{something}
Else
{something}
End If




Re: Help with ASP Webpage by Roland

Roland
Sat Dec 27 18:09:54 CST 2003

'vbscript
if something = this then
do this
else
do that
end if

//jscript
if(something == this) {
do this;
} else {
do that;
}

JScript doesn't require the word THEN but VBScript does. You're missing it
in your IF statements.

--
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.