I need to store all data from an recordset in scripting.dictionary, but my code just seems to store the latest data of the recordset.
hope anyone can help
**** Begin Code *****
Function getMenuPoint(ByRef pMenuDict)
Set mRS = Server.CreateObject("ADODB.RecordSet")
Set tmpDic = Server.CreateObject("Scripting.Dictionary")
tmpDic.Add "ID",""
tmpDic.Add "Name", ""
tmpDic.Add "URL", ""
tmpDic.Add "PicActive",""
tmpDic.Add "PicNormal",""
SQLStr = "select * from menu"
mRS.Open SQLStr, ConStr
getMenuPoint = false
if not (mRS.EOF and mRS.BOF) then
mRS.MoveFirst
i = 0
while not mRS.EOF
i = i + 1
tmpDic("ID") = mRS.Fields("ID")
tmpDic("Name") = mRS.Fields("Name")
tmpDic("URL") = mRS.Fields("URL")
tmpDic("PicActive") = mRS.Fields("PicActive")
tmpDic("PicNormal") = mRS.Fields("PicNormal")
pMenuDict.add i, ""
Set pMenuDict(i) = tmpDic
response.Write "<br>" & pMenuDict(1)("Name")
mRS.MoveNext
getMenuPoint = true
wend
end if
mRS.Close
Set mRS = Nothing
End Function

**** End Code ******