Dictionary object help

Results 1 to 2 of 2

Thread: Dictionary object help

  1. #1
    Join Date
    Dec 1969

    Default Dictionary object help

    I have two dictionary object for a store. One holding the item id and quanity and one holding the sale price item id and quanity. <BR>My question is- <BR>1. Is the right? Am i allow to use two dictionary objects? The sale dictionary object doesnt seem to hold more then one ID. <BR><BR>2. How do i search though both Dictionary objects at once. <BR>I need to pull id from both. If there is an ID in the sale dict object then i pull out certain info from the database. If it is from the other i pull out the other info.<BR><BR>Any IDEA??? <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Dictionary object help

    Since you won&#039t show your code (I asked you to last time you asked this same question), I will have to demonstrate that you *CAN* do what you want:<BR><BR>&#060;%<BR>Set one = Server.CreateObject("Scripting.Dictionary")<BR>Set two = Server.CreateObject("Scripting.Dictionary")<BR>one .Add "Bill", "first thing added to one"<BR>one.Add "Joe", "easy to add multiple items!"<BR>one.Add "Harry", "as many as you want...THOUSANDS!"<BR>For i = 1 To 100<BR>&nbsp; &nbsp; two.Add "Item#" & i, "just to show you...added " & i & " items to &#039two&#039"<BR>Next<BR><BR>value1 = one("Bill") &#039 retrieve a value from one<BR>If Not one.Exists("Rowrbazzle") Then &#039 presumably, that key does not exist<BR>&nbsp; &nbsp; Randomize<BR>&nbsp; &nbsp; value = two("Item#" & Int(1 + Rnd * 100)) &#039 pick an item in two randomly<BR>End If<BR><BR>Response.Write "value1 is " & value1 & "&lt;BR&#062;"<BR>Response.Write "value2 is " & value2 & "&lt;BR&#062;"<BR>%&#062;<BR><BR>Yes, that works.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts