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!

This key is already associated with an element of this collection

Status
Not open for further replies.

richey1

Technical User
Oct 5, 2004
184
GB
getting this error on my sitemap page (been working fine for 1½ years !)
its a 3rd party software cms but the error point to line 77 of sitemap.asp which is shown further below (sorry for the length)
but line 77 points to
lp = smma(1,i)

now the sp mnuTreeAll i have put into SQL QA and it runs fine - I have checked there are no duplicate p_page_id's in the table page_data which the SP runs off

any other ideas ?

much appreciated
gareth

sitemap.asp
-----------
<%

Dim pSiteMapDone, pSiteMapHEAD, pSiteMapBODY,pSITEMAPLEVELS
dim smma, sma, smdict, smm1in, smselpage

const SpacerImg = "images/space1.gif"
const ArrowImg = "images/arrowmap.gif"

Function SiteMapDisplayPages(cnt, level)
dim ci ' Current Index
dim cp ' Current Parent

If Level >= (pSITEMAPLEVELS)then Exit Function
cp = cnt
ci = smDict.Item(cp)
do while smma(1, ci) = cp ' Keep going while the same parent
' Check that that page is not hidden and that the user has the
' permissions to view the page
if (smma(9,ci)<>0) OR ((smma(6, ci) and maccess) = 0 AND smma(8,ci) <> 0) then
' Do Nothing and hide the item from the menu
else
title = smma(3,ci)
'title = replace(smma(3,ci), "'", "\'")
'title = replace(smma(3,ci), """", "\""")
pSiteMapBODY = pSiteMapBODY & "<div style=""padding-left:" & level*28 & "px; text-align: left;""><p><a href=""ILINK|" & smma(0,ci) & ",|"">" & title & "</a><span class=""invis"">.</span></p></div>" & vbCrLf
sma = sma + 1
SiteMapDisplayPages smma(0,ci), level+1
end if
ci = ci + 1
if ci > ubound(smma,2) then exit do
loop
End Function


Function SiteMapGenerate(Params, DBConn, PageID, ParentID, TopID)
Dim RS, CNN, SQL, i, lp, pcnt



Set cnn = CreateObject("ADODB.Connection")
cnn.Open DBConn

set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = CNN
objCmd.CommandType = &H0004
objCmd.CommandText = "mnuTreeAll"

set rs = objCmd.Execute

if rs.EOF then
rs.Close
cnn.Close
set cnn = nothing
set rs = nothing
pSiteMapHEAD = ""
pSiteMapBODY = ""
exit function
end if
smma = rs.GetRows()
rs.Close
CNN.Close
set CNN = nothing
set RS = nothing

'*********************************************************************
' We now have all the pages we need in an array, so map the
' parent IDs using a dictionary object to speed up access later
' And index the pages themselves for quicker look up
'*********************************************************************

set smdict = Server.CreateObject("Scripting.Dictionary")

lp = -1
for i = lbound(smma,2) to ubound(smma,2)
if smma(1,i) <> lp then
lp = smma(1,i)
smdict.Add lp, i
end if
next

sma = 0

SiteMapDisplayPages 0, 0

erase smma
'set smma = nothing
set smdict = nothing

pSiteMapdone = True
End Function

Function sitemapDisplay(Params, DBConn, PageID, ParentID, TopID)

pSITEMAPLEVELS = cint(ParamValue(Params,"maxlevels",99))
If pSiteMapdone <> true Then
SiteMapGenerate Params, DBConn, PageID, ParentID, TopID
objHEAD = pSiteMapHEAD
else
objHEAD = ""
End If

objBODY = pSiteMapBODY
objONLOAD = ""
objONRESIZE = ""
objONUNLOAD = ""

sitemapDisplay = True
End Function

Function sitemapIsSupported(Params, DBConn, PageID, ParentID, TopID, PublishType)
' We may need to do some database lookups to work out if the page can be
' published in a particular way
select case UCase(PublishType)
case "HTM"
sitemapIsSupported = True
case "ASP"
sitemapIsSupported = False
case else
sitemapIsSupported = False
end select
End Function

Function sitemapPublish(Params, DBConn, PageID, ParentID, TopID, PublishType)
sitemapPublish = False
End Function

%>
 
sorry it is the line

smdict.Add lp, i

that is getting highlighted as the error

regards
 
Have a look at the dictionary object. Dictionary objects allows you to store data in a key = value format.

-DNG
 
thanks DNG

I've added in this now, to get it working again

'rh amends
if smdict.Exists(lp) then smdict.Remove(lp)
smdict.Add lp, i
end if

I will look at the dictionary object, but have you any idea what it might be considering I have no duplicates in my table ?
or could it be a myriad of things ?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top