p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Option Explicit


Message #1 by Patrick Mair <pmair@e...> on Thu, 7 Nov 2002 11:20:53 -0500
Patrick, if you read the error message you're getting again you'll
figure this out yourself.  It's complaining about the <%@LANGUAGE etc.%>
directive appearing more than once in your page code, suggesting that it
appears in one or more of your include files.  Delete it from all
includes and you'll be able to move on to the next problem!  Tough it
out... Option Explicit is a very good thing.  :-)



-----Original Message-----
From: Patrick Mair [mailto:pmair@e...] 
Sent: Thursday, November 07, 2002 11:21 AM
To: Code Clinic
Subject: [proasp_codeclinic] Option Explicit


After reading a number of articles encouraging the use of Option
Explicit when programming ASP's, I've taken a shot at using them in my
pages. Unfortunately I've hit a few snags.  I've been getting a lot of
Internal Server Errors, as well as errors like "The @ command must be
the first command within the Active Server Page."  I understand what
this error means I think, but I'm not sure how to get around it.

I have a navigation bar that gets included at the top of most of my
pages like this:

<!--#include virtual="/dropdown/resources/navbar.asp" -->

and I also include my database connection on most pages:

<!--#include virtual="/db_info.asp" -->

So the part I'm stuck on is, do I only include the <% Option Explicit %>
line in one of those pages?  Or all of them?  I have:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

in all my pages but when I turn option explicit on I don't think it will
let me do my includes properly because it's seeing that line 3 times
instead of once... I think.

Could someone point me in the right direction here?  Maybe I shouldn't
be including my navbar and database connection strings like this?

Patrick




  Return to Index