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 September 18th, 2018, 09:08 AM
Registered User
Join Date: Sep 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issue with Count propety


I have a very strange issue with the Count property.. on the below code I get the error "This key is already associated with an element of this collection" but the problem, which have been testet, is that the collection values are unique:

	Dim robConn, rSQL, objRobot, strWebsite, o, f
	Set robConn = Server.CreateObject("ADODB.Connection")

	rSQL = "SELECT id, name, bot_type_id, machine_name, enabled FROM dbo.robots ORDER BY id;" 
	Set objRobot = robConn.Execute(rSQL)
	set o=Server.CreateObject("Scripting.Dictionary")
	set f=Server.CreateObject("Scripting.Dictionary")
	While Not objRobot.EOF
	strWebsite =  objRobot("machine_name") & ".koncern.net"
	if IsWebsiteUp( strWebsite ) Then
	o.Add objRobot("id"), objRobot("machine_name") 
	f.Add objRobot("id"), objRobot("machine_name")
	End If 

	Set objRobot = Nothing
<font style="color: #e4013a;">
<% Response.Write("Online: " & o.Count) %>
<% Response.Write("Offline: " & f.Count) %> 
	set o=nothing
	set f=nothing
The line refered to by the error is
o.Add objRobot("id"), objRobot("machine_name")
Can anyone help me figure out what is wrong?

Best Regards
Stig :-)
Old September 19th, 2018, 05:37 AM
Registered User
Join Date: Sep 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

When you start, what is notification


Last edited by jminatel; September 19th, 2018 at 08:48 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not sure Excel issue or Batch file issue - Application.Workbooks("Book2.xls").Close justinferns Excel VBA 3 October 4th, 2011 03:09 PM
XSL: Count = Count + 1 elayaraja.s XSLT 3 July 18th, 2008 03:21 AM
is there any in built function to count page count g.tamilselvan MySQL 1 February 15th, 2006 07:43 AM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM

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