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 :-)