Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include Error 1

Status
Not open for further replies.

tsp1lrk

IS-IT--Management
May 30, 2001
103
US
I'm adding an include to my simple default.asp page and I get the following error:

Microsoft VBScript compilation error '800a0400'

Expected statement

/ads/120.asp, line 1

Option Explicit
^

I'm NEW with ASP and I'm not sure what's missing or wrong!!



Here is the code for 120.asp:
<% Option Explicit %>

<!-- #include virtual=&quot;/dbwork/db.asp&quot;-->

<%
Dim objConn
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString = application(&quot;DSN&quot;)
objConn.Open

Dim objRS
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open &quot;SELECT * FROM ads where width=120 and hunter=1 and activead=1&quot;, objConn, adOpenStatic, adLockReadOnly

if objRS.eof then%>
<img src=&quot; width=131 height=73 border=0 alt=&quot;&quot;>
<% else

Dim rndMax
rndMax = CInt(objRS.RecordCount)
objRS.MoveFirst

Dim rndNumber ' RANDOMIZE RECORDS
Randomize Timer
rndNumber = Int(RND * rndMax)


objRS.Move rndNumber

Response.Write(&quot;<a href=' trim(objRS(&quot;AID&quot;))& &quot;&url=&quot;& trim(objRS(&quot;adURL&quot;)) &&quot;'><img src='../images/ads/&quot;& trim(objRS(&quot;imgsrc&quot;)) &&quot;' border='0' width='468' height='60' alt='&quot;& trim(objRS(&quot;altText&quot;))&&quot;'></a>&quot;)

Call OpenConn()
Dim updateAdView
updateAdView= &quot;Update ads set webviews =&quot; & objRS(&quot;webviews&quot;) + 1 &&quot; where AID=&quot;& objRS(&quot;aid&quot;)
dbc.execute(updateAdView)
Call CloseConn()
end if

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing
%>


Thanks,
Lisa
 
If 120.asp is your file you are including in your default page you will need to remove the Option Explicit. Option Explicit is only decalred one time before any other operations. When you include a file the server treates it the same as if you had just copy and pasted that file into the file you are including it in. Therefore if you have an option explicit in both your files it gets declared two times, and since the included one is second that is the one that throws the error. Try removing it from your included file and see if that clears it up for you.
-Tarwn &quot;Customer Support is an art not a service&quot; - marketing saying
&quot;So are most other forms of torture&quot; - programmers response
(The Wiz Biz - Rick Cook)
 
[tt]


This is usually due to embedding double quotes inside a string, e.g.

strMyName = &quot;John &quot;James&quot; Sample&quot;

To fix, either double-up the quotes, or use single quotes:

strMyName = &quot;John &quot;&quot;James&quot;&quot; Sample&quot;

or

strMyName = &quot;John 'James' Sample&quot;
[tt]&quot;A Successful man is one who can build
a firm foundation with the bricks
that others throw at him&quot;
[/tt]

banana.gif
rockband.gif
banana.gif
 
Thanks everyone! I removed it and VOILA! It worked. This forum has helped me out so much, it's unreal. Thanks again.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top