423,688 Members | 1,889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,688 IT Pros & Developers. It's quick & easy.

Option Explicit causing VBScript error

P: n/a
Hi all,

I am simply trying to include the Option Explicit declaration at the top of
an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is correct.
Is it the placement?

Thanks...
Mar 23 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
This is <SCRIPT LANGUAGE=... not <SCRIPT> LANGUAGE=

--
Patrice

"John Kotuby" <jo***@powerlist.com> a écrit dans le message de news:
uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the top
of an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is
correct. Is it the placement?

Thanks...

Mar 23 '06 #2

P: n/a
Just to be on the safe side, you may want to tell us what you are trying to
do. This should be now syntactically correct but this is just an empty
server side block.
Perhaps you confused with <%@ Language=VBScript %> ?
--

"Patrice" <a@bc.c> a écrit dans le message de news:
ep**************@TK2MSFTNGP09.phx.gbl...
This is <SCRIPT LANGUAGE=... not <SCRIPT> LANGUAGE=

--
Patrice

"John Kotuby" <jo***@powerlist.com> a écrit dans le message de news:
uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the top
of an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is
correct. Is it the placement?

Thanks...


Mar 23 '06 #3

P: n/a

"John Kotuby" <jo***@powerlist.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the top of an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is correct. Is it the placement?

Thanks...


Yes Option Explict should be the first line of script and above any content
that is sent to the client.

In your case you have an include file preceeding it which likely contains
script.

Use:-

<% Option Explicit %>
<!-- #INCLUDE FILE="adovbs.inc" -->

Anthony.

Mar 23 '06 #4

P: n/a
Thank you Anthony,

You are indeed correct and how silly of me. Of course the "adovbs.inc" file
includes script.
Placing <% Option Explicit %> at the top fixed the problem.

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...

"John Kotuby" <jo***@powerlist.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the top

of
an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is

correct.
Is it the placement?

Thanks...


Yes Option Explict should be the first line of script and above any
content
that is sent to the client.

In your case you have an include file preceeding it which likely contains
script.

Use:-

<% Option Explicit %>
<!-- #INCLUDE FILE="adovbs.inc" -->

Anthony.

Mar 23 '06 #5

P: n/a
Thanks Patrice,

For noticing my Syntax error in the LANGUAGE declaration. Actually the code
never even got to that line because it bombed out on the <% Option Explicit
%> which I had placed after the:
<!-- #INCLUDE FILE="adovbs.inc" -->
Which itself contained script.

Now that I have fixed both errors the code is running.

Thanks again.

"Patrice" <a@bc.c> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
Just to be on the safe side, you may want to tell us what you are trying
to do. This should be now syntactically correct but this is just an empty
server side block.
Perhaps you confused with <%@ Language=VBScript %> ?
--

"Patrice" <a@bc.c> a écrit dans le message de news:
ep**************@TK2MSFTNGP09.phx.gbl...
This is <SCRIPT LANGUAGE=... not <SCRIPT> LANGUAGE=

--
Patrice

"John Kotuby" <jo***@powerlist.com> a écrit dans le message de news:
uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the top
of an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is
correct. Is it the placement?

Thanks...



Mar 23 '06 #6

P: n/a
Sorry for the poor help, I shouldn't have stopped at the first thing I saw.

A possible approach could be :
- create an include file such as page.asp that contains both the Option
explicit and includes all the present and future files you'll need on each
page such as adovbs.inc (another option would be to use the type library by
declaring it in global.asa).

This way :
- you just have to include this general file and you can start with your
begin script tag.
- if later you need a general function on most of your page you'll be able
to include this file in your general include file and all pages you have
written will be right now ready to use the new function

--
Patrice

"John Kotuby" <jo***@powerlist.com> a écrit dans le message de news:
uC**************@TK2MSFTNGP11.phx.gbl...
Thanks Patrice,

For noticing my Syntax error in the LANGUAGE declaration. Actually the
code never even got to that line because it bombed out on the <% Option
Explicit %> which I had placed after the:
<!-- #INCLUDE FILE="adovbs.inc" -->
Which itself contained script.

Now that I have fixed both errors the code is running.

Thanks again.

"Patrice" <a@bc.c> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
Just to be on the safe side, you may want to tell us what you are trying
to do. This should be now syntactically correct but this is just an empty
server side block.
Perhaps you confused with <%@ Language=VBScript %> ?
--

"Patrice" <a@bc.c> a écrit dans le message de news:
ep**************@TK2MSFTNGP09.phx.gbl...
This is <SCRIPT LANGUAGE=... not <SCRIPT> LANGUAGE=

--
Patrice

"John Kotuby" <jo***@powerlist.com> a écrit dans le message de news:
uz**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am simply trying to include the Option Explicit declaration at the
top of an ASP page and am getting an error:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/transferkey.asp, line 2
<!-- #INCLUDE FILE="adovbs.inc" -->
<% Option Explicit %>
<SCRIPT> LANGUAGE="VBScript" RUNAT="Server" </SCRIPT>
<% .... other code
%>

What am I doing wrong? According to a book on ASP 3.0 the syntax is
correct. Is it the placement?

Thanks...



Mar 24 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.