?
Solved

How to add items without repeating

Posted on 2006-05-24
3
Medium Priority
?
311 Views
Last Modified: 2008-02-01
Hello Experts,

I Have something like

<Object Runat="Server" Scope="application" ID="dOnlineUsers" ProgID="Scripting.Dictionary" VIEWASTEXT></Object>
...
...
...

dOnlineUsers.Add Session.SessionID, sUserInfo

but I dont want to add if an item is already added.

Thanks in advance

Regards
0
Comment
Question by:wildcard76
  • 2
3 Comments
 
LVL 3

Author Comment

by:wildcard76
ID: 16749716
no answers yet
so increasing points
0
 
LVL 7

Accepted Solution

by:
SimonBlake earned 900 total points
ID: 16750262

Hi, not sure if this is what you are after, but, assuming this is a true dictionary object, then you need to use the

.Exists(key) to test to see if the key is already there...

So you would use it like:

If dOnlineUsers.Exists(Session.SessionID) = False Then
   dOnlineUsers.Add Session.SessionID, sUserInfo
End If

Hope that helps
0
 
LVL 3

Author Comment

by:wildcard76
ID: 16759220
yes that does the trick :)

thanks and regards

cagatay
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question