Results 1 to 1 of 1

Thread: checking if a value exists in an array.. if so, imcerementing a total

  1. #1
    Join Date
    Dec 2004
    Posts
    152

    Editing the item value of key in Dictionary

    Hi.
    (problems updating the item in dictionary object)

    I have 2 tables. portals and referals.
    each portal has a referal against it (1 of upto 6) .
    Referals in my dictionary will be keys and each key will maintain a count. (item)
    I wish to count the number of different referals for each portal.


    MY sub is below. I think i correctly create the keys but after i then get the portals to begin a check , I dont know how to update the item with + 1
    The code i am missing is below if stat.Exists(portReferal)= true then :

    Code:
    sub getStats() 
     
        'get the referals
        Set RS   = Server.CreateObject("ADODB.Recordset") 
    	set stat = Server.CreateObject("Scripting.Dictionary")
        strSQL = "SELECT * FROM referals"
        RS.Open strSQL, Conn 
    	arrayCol=0
    	arrayRow=0
    	RS.MoveFirst 
    	
    	do while not RS.EOF
    	      stat.add RS("referal"),0
    	   RS.movenext 
    	loop
    	
    	set RS=nothing
    	Set RS = Server.CreateObject("ADODB.Recordset") 
    	strSQL = "SELECT * FROM comments where portal="request.queryString("portal")
    	RS.Open strSQL, Conn 
    	RS.MoveFirst  
    	
    	do while not RS.EOF
    	     portReferal=RS("referal")
    		 for i = 0 To stat.Count -1
    		    if stat.Exists(portReferal)= true then
                   'how do I update the item here???????????????			end if
             next
        RS.movenext
    	loop
    	
    end sub
    Last edited by numbenator; 16 Aug 2005 at 06:09 AM.

Posting Permissions

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