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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft VBScript compilation error '800a0411'

Status
Not open for further replies.
Jun 1, 2004
65
US
HEy Team, I notice this yesterday on my webpage and is causing me some grief. Everytime I click on a link called catering I get the following error:

Microsoft VBScript compilation error '800a0411'

Name redefined

/vsadmin/inc/inccategories.asp, line 8

Dim sSQL,rs,alldata,cnn,rowcounter,success,startlink,secdesc
----^

I've looked through the file but I can't see anytihg wrong with it. I've even went as far as restoring it from a back up copy that I had and I still get the error. Any help would be appreciated.
 
The error states that one of the following variables is redeclared at that line.
Is there somewhere above a variable with the same name as the one in line 8?
Maybe in a subroutine that is called?

If possible please post some code so we can have a look...

Hope this helps...

--------------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
 
This is a lot of code, I'm not sure if you would want me to post it on here or not but here it goes.

Dim sSQL,rs,alldata,cnn,rowcounter,success,startlink,secdesc
theid=Trim(Replace(Request.QueryString("id"),"'",""))
if Trim(Replace(Request.QueryString("cat"),"'",""))<>"" then theid=Trim(Replace(Request.QueryString("cat"),"'",""))
if theid="" OR theid="ALL" OR NOT IsNumeric(theid) then theid="0"
if explicitid<>"" AND IsNumeric(explicitid) then theid=explicitid
if NOT IsNumeric(categorycolumns) OR categorycolumns="" then categorycolumns=1
cellwidth = Int(100/categorycolumns)
if usecategoryformat=3 then
afterimage="<br>"
beforedesc=""
elseif usecategoryformat=2 then
afterimage=""
beforedesc=""
else
usecategoryformat=1
afterimage=""
beforedesc="</td></tr><tr><td class=""catdesc"" colspan=""2"">"
end if
border=0
if IsEmpty(catseparator) then catseparator = "<br>&nbsp;"
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
Session("frompage")=Request.ServerVariables("URL")&IIfVr(Trim(Request.ServerVariables("QUERY_STRING"))<>"","?","")&Request.ServerVariables("QUERY_STRING")
tslist = ""
thetopts = theid
topsectionids = theid
for index=0 to 10
if thetopts=0 then
if theid="0" then
tslist = xxHome & " " & tslist
else
tslist = "<a href=""categories.asp"">"&xxHome&"</a> " & tslist
end if
exit for
elseif index=10 then
tslist = "<b>Loop</b>" & tslist
else
sSQL = "SELECT sectionID,topSection,sectionName,rootSection FROM sections WHERE sectionID=" & thetopts
rs.Open sSQL,cnn,0,1
if NOT rs.EOF then
if rs("sectionID")=Int(theid) then
tslist = " &raquo; " & rs("sectionName") & tslist
elseif rs("rootSection")=1 then
tslist = " &raquo; <a href=""products.asp?cat="& rs("sectionID") & """>" & rs("sectionName") & "</a>" & tslist
else
tslist = " &raquo; <a href=""categories.asp?cat="& rs("sectionID") & """>" & rs("sectionName") & "</a>" & tslist
end if
thetopts = rs("topSection")
topsectionids = topsectionids & "," & thetopts
else
tslist = "Top Section Deleted" & tslist
rs.Close
exit for
end if
rs.Close
end if
next
if theid="0" then
tslist = tslist & " &raquo; <a href=""products.asp"">"&xxAlProd&"</a>"
else
tslist = tslist & " &raquo; <a href=""products.asp?cat="&theid&""">"&xxAlProd&"</a>"
end if
sSQL = "SELECT sectionID,sectionName,rootSection,sectionImage,sectionOrder,sectionDescription FROM sections WHERE topSection=" & theid & " AND sectionDisabled<>1 ORDER BY sectionOrder"
rs.Open sSQL,cnn,0,1
if rs.eof or rs.bof then
success=false
mess1 = "<p>&nbsp;</p>" & xxNoCats
else
alldata=rs.getrows
success=true
mess1 = xxClkPrd & "<br>&nbsp;"
end if
rs.Close
if (usecategoryformat=1 OR usecategoryformat=2) then numcolumns=2*categorycolumns else numcolumns=categorycolumns
%>
<table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<tr>
<td width="100%">
<table width="<%=innertablewidth%>" border="<%=border%>" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td align="center"<% if numcolumns>1 then response.write " colspan='"&numcolumns&"'"%>>
<p><b><%=mess1%></b></p>
</td>
</tr>
<%
if nowholesalediscounts=true AND Session("clientUser")<>"" then
if ((Session("clientActions") AND 8) = 8) OR ((Session("clientActions") AND 16) = 16) then noshowdiscounts=true
end if
if success then
tdt = Date()
if noshowdiscounts<>true then
if theid="0" then
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons WHERE (cpnSitewide=1 OR cpnSitewide=2) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND cpnIsCoupon=0"
else
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE (((cpnSitewide=0 OR cpnSitewide=3) AND cpaType=1 AND cpaAssignment IN ('"&Replace(topsectionids,",","','")&"')) OR cpnSitewide=1 OR cpnSitewide=2) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND cpnIsCoupon=0"
end if
rs.Open sSQL,cnn,0,1
if NOT rs.EOF then %>
<tr>
<td align="left"<% if numcolumns>1 then response.write " colspan='"&numcolumns&"'"%>>
<p><b><%=xxDsCat%></b><br><font color="#FF0000" size="1">
<% do while NOT rs.EOF
response.write rs("cpnWorkingName") & "<br>"
rs.MoveNext
loop %>&nbsp;</font></p>
</td>
</tr>
<% end if
rs.Close
end if
response.write "</table>"
if IsEmpty(showcategories) OR showcategories=true then
response.write "<table width="""&innertablewidth&""" border="""&border&""" cellspacing="""&innertablespacing&""" cellpadding="""&innertablepadding&""" bgcolor="""&innertablebg&"""><tr>"
if allproductsimage<>"" then response.write "<td class=""catimage"" width=""5%"" align=""right""><a href='products.asp'><img class=""catimage"" src='"&allproductsimage&"' border='0'></a>" & afterimage & "</td>"
response.write "<td class=""catnavigation"">"
response.write "<p class=""catnavigation""><b>" & tslist & "</b></p>"
response.write "<p class=""navdesc"">" & xxAlPrCa & catseparator & "</p>"
response.write "</td></tr>" & vbCrLf
response.write "</table>"
end if
response.write "<table width="""&innertablewidth&""" border="""&border&""" cellspacing="""&IIfVr(usecategoryformat=1 AND categorycolumns>1,0,innertablespacing)&""" cellpadding="""&IIfVr(usecategoryformat=1 AND categorycolumns>1,0,innertablepadding)&""" bgcolor="""&innertablebg&""">"
tdt = Date()
columncount=0
FOR rowcounter= 0 TO ubound(alldata,2)
if alldata(2,rowcounter)=0 then
startlink="<a href='categories.asp?cat="&alldata(0,rowcounter)&"'>"
else
startlink="<a href='products.asp?cat="&alldata(0,rowcounter)&"'>"
end if
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE (cpnSitewide=0 OR cpnSitewide=3) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND cpnIsCoupon=0 AND cpaType=1 AND cpaAssignment='"&alldata(0,rowcounter)&"'"
alldiscounts = ""
if noshowdiscounts<>true then
rs.Open sSQL,cnn,0,1
do while NOT rs.EOF
alldiscounts = alldiscounts & rs("cpnWorkingName") & "<br>"
rs.MoveNext
loop
rs.Close
end if
secdesc = Trim(alldata(5,rowcounter))
noimage = (Trim(alldata(3,rowcounter))="" OR IsNull(alldata(3,rowcounter)))
if columncount=0 then response.write "<tr>"
if usecategoryformat=1 AND categorycolumns>1 then response.write "<td width=""" & cellwidth & "%"" valign=""top""><table width=""100%"" border="""&border&""" cellspacing="""&innertablespacing&""" cellpadding="""&innertablepadding&"""><tr>"
if (usecategoryformat=1 OR usecategoryformat=2) AND NOT noimage then
cellwidth = cellwidth - 5
response.write "<td class=""catimage"" width=""5%"" align=""right"">" & startlink&"<img alt="""&replace(alldata(1,rowcounter),"""","")&""" class=""catimage"" src='"&alldata(3,rowcounter)&"' border='0'></a>" & afterimage & "</td>"
end if
response.write "<td class=""catname"" width=""" & IIfVr(usecategoryformat=1 AND categorycolumns>1,95,cellwidth) & "%""" & IIfVr((usecategoryformat=1 OR usecategoryformat=2) AND noimage," colspan='2'","") & ">"
if (usecategoryformat=1 OR usecategoryformat=2) AND NOT noimage then cellwidth = cellwidth + 5
if usecategoryformat<>1 AND usecategoryformat<>2 AND NOT noimage then response.write startlink&"<img alt="""&replace(alldata(1,rowcounter),"""","")&""" class=""catimage"" src='"&alldata(3,rowcounter)&"' border='0'></a>" & afterimage
response.write "<p class=""catname""><b>"&startlink&alldata(1,rowcounter)&"</a>"&xxDot&"</b>"
if alldiscounts<>"" then response.write " <font color=""#FF0000""><strong>"&xxDsApp&"</strong><br><font size=""1"">" & alldiscounts & "</font></font>"
if secdesc <> "" then response.write "</p>" else response.write catseparator & "</p>"
if secdesc <> "" then response.write beforedesc & "<p class=""catdesc"">" & secdesc & catseparator & "</p>"
response.write "</td>" & vbCrLf
if usecategoryformat=1 AND categorycolumns>1 then response.write "</tr></table></td>"
columncount = columncount + 1
if columncount=categorycolumns then
response.write "</tr>"
columncount=0
end if
next
if columncount<categorycolumns AND columncount<>0 then
do while columncount<categorycolumns
response.write "<td " & IIfVr(usecategoryformat=2, " colspan='2'" , "") & ">&nbsp;</td>"
columncount = columncount + 1
loop
response.write "</tr>"
end if
end if
cnn.Close
response.write "</table><table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" bgcolor="""">"
response.write "<tr><td><img src=""images/clearpixel.gif"" width=""300"" height=""1""></td></tr>"
set rs = nothing
set cnn = nothing
%>
</table>
</td>
</tr>
</table>
 
And what about the 7 first lines of this script ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
They are just your Typical lines from the developer. All of those have been marked out with a ' the first 7 lines should be:

<%
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business
'Solutions SL is forbidden.
'Author:
 
Question: Is the code that you posted that of the INCLUDE file or of the that that INCLUDES it?

Does that even make sense?

What I'm trying to say is that your directory structure in the error makes it seem like there is an include file:
/vsadmin/[red]inc/inc[/red]categories.asp, line 8

Now I think that K0b3 is absolutely right about the cause of this error. But the thing is, it will show up on the second time on of those variable is re-declared.

So if the error is showing up in the INCLUDE file, then the variable is first declared in the that that includes it...

Frick, I cant seem to say this without making it sound all muddy.

Ok, suppose you have 2 files:
File1.asp
<%
Dim foo
foo = 10
%>


And also File2.asp
<%
Dim foo
foo = 3

<!-- Include File1.asp -->

foo = foo + 3
%>


So the problem is that File1.asp is included in File2.asp but they both have a Dim for a variable named "foo
 
I'd check the another included asp pages for any global variable declaration.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
OK, then look at categories.asp and see if any variables used in it have the same name as any of the variables in inccategories.asp
 
I guess sSQL is defined elsewhere ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hey team thanks for the help so far. I've searched through all the files and am not able to find where the sSQL or any other is being defined twice. The Catagories.asp is your typical ASP file for a website.
 
Do any of your files INCLUDE other files or is maybe the same file included more than once?
 
To discover which variable is multiple times defined, replace this:
Dim sSQL,rs,alldata,cnn,rowcounter,success,startlink,secdesc
By this:
Dim sSQL
Dim rs
Dim alldata
Dim cnn
Dim rowcounter
Dim success
Dim startlink
Dim secdesc

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ok when I break it down that way I get this
Microsoft VBScript compilation error '800a0411'

Name redefined

/vsadmin/inc/inccategories.asp, line 9

Dim sSQL

When I search through the file for sSQL I get the following results:

sSQL = "SELECT sectionID,topSection,sectionName,rootSection FROM sections

WHERE sectionID=" & thetopts

sSQL = "SELECT

sectionID,sectionName,rootSection,sectionImage,sectionOrder,sectionDescription FROM sections

WHERE topSection=" & theid & " AND sectionDisabled<>1 ORDER BY sectionOrder"

sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons WHERE

(cpnSitewide=1 OR cpnSitewide=2) AND cpnNumAvail>0 AND

cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND cpnIsCoupon=0"

sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN

cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE (((cpnSitewide=0 OR cpnSitewide=3) AND

cpaType=1 AND cpaAssignment IN ('"&Replace(topsectionids,",","','")&"')) OR cpnSitewide=1 OR

cpnSitewide=2) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND

cpnIsCoupon=0"

I hope this helps out

 
And that variable, sSQL, it is not used anywhere in Catagories.asp or in any other file that might be included by Catagories.asp or perhaps Catagories.asp is itself included in another file?
 
Have you the following instruction at the very beginning of the asp page(s):
Option Explicit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The cammand Option Explicit is not located in the file. When I add it it gives me the error
Microsoft VBScript compilation error '800a0400'

Expected statement

/vsadmin/inc/inccategories.asp, line 2

Option Explicit


Also I've checked all of the other files and couldn't find any other files with the sSQL defined. Now can an update to the server cause this issue also?
 
well Option Explicit should be the first line in a script so putting in the include file is no good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top