Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issue with Count propety

Hi,

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:

Code:
<%
	Dim robConn, rSQL, objRobot, strWebsite, o, f
	Set robConn = Server.CreateObject("ADODB.Connection")
	robConn.ConnectionString="Provider=SQLOLEDB; DATA SOURCE=<SQLSERVER>;UID=<USERNAME>;PWD=<PASSWORD>;DATABASE=<DATABASE>"
	robConn.Open

	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") 
	Else
	f.Add objRobot("id"), objRobot("machine_name")
	End If 
 
	objRobot.MoveNext

	Wend
	objRobot.Close
	Set objRobot = Nothing
%>  
<font style="color: #e4013a;">
<% Response.Write("Online: " & o.Count) %>
<br>
<% Response.Write("Offline: " & f.Count) %> 
</font>
<%
	set o=nothing
	set f=nothing
%>
The line refered to by the error is
Code:
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
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.