Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2004, 05:38 PM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default store recordset in scripting.dictionary

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 ******






Similar Threads
Thread Thread Starter Forum Replies Last Post
use regex to split string store in dictionary edman747 VB How-To 0 January 29th, 2007 12:02 AM
using dictionary object rajiv_software Classic ASP Basics 4 June 21st, 2005 02:53 PM
Scripting Dictionary sachindhillan Classic ASP Basics 0 August 17th, 2004 09:34 AM
Data Dictionary shamsad Oracle 1 February 25th, 2004 03:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.