Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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 :-)
Reply With Quote
  #2 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 06:43 AM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM



All times are GMT -4. The time now is 11:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.