I have some code which is listed below. The code will work the first time through. The problem is that when it loops, it does not seem to be reopening the data connection. Can anyone figure this one out?
<% Dim GamArray
GamArray= Split(Gam,",")
Dim Counter
For Counter=LBound(GamArray) to UBound(GamArray)
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DATABASE=runtime;DSN=WEBSQL;UID=wwuser;Password=wwuser"
Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConn cmdDC.CommandText = "select Value,convert(Varchar,datetime,101)Date,DatePart(HH,datetime)Hour,DatePart(n, datetime)Minute from History where tagname='FGam"&GamArray(Counter)&"_OEE' and datetime between'"& QueryStart &"' and '"& QueryStop &"' and value is not NULL AND wwVersion = 'Latest' AND wwRetrievalMode = 'Cyclic' and wwresolution=300000"
cmdDC.CommandType = 1
Set rsDC1 = Server.CreateObject("ADODB.Recordset")
rsDC1.Open cmdDC, , 0, 1
If Not rsDC1.EOF Then rsDC1.MoveFirst
Do While Not rsDC1.EOF
Graph1= Graph1 & rsDC1("Date") &" "& rsDC1("Hour") &":" & rsDC1("Minute") & ", " & rsDC1("Value") & "; "
rsDC1.MoveNext
Loop
rsDC1.Close
Set rsDC1 = Nothing
DataConn.Close
Set DataConn = Nothing
Response.write GamArray
Next %>
<% Dim GamArray
GamArray= Split(Gam,",")
Dim Counter
For Counter=LBound(GamArray) to UBound(GamArray)
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DATABASE=runtime;DSN=WEBSQL;UID=wwuser;Password=wwuser"
Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConn cmdDC.CommandText = "select Value,convert(Varchar,datetime,101)Date,DatePart(HH,datetime)Hour,DatePart(n, datetime)Minute from History where tagname='FGam"&GamArray(Counter)&"_OEE' and datetime between'"& QueryStart &"' and '"& QueryStop &"' and value is not NULL AND wwVersion = 'Latest' AND wwRetrievalMode = 'Cyclic' and wwresolution=300000"
cmdDC.CommandType = 1
Set rsDC1 = Server.CreateObject("ADODB.Recordset")
rsDC1.Open cmdDC, , 0, 1
If Not rsDC1.EOF Then rsDC1.MoveFirst
Do While Not rsDC1.EOF
Graph1= Graph1 & rsDC1("Date") &" "& rsDC1("Hour") &":" & rsDC1("Minute") & ", " & rsDC1("Value") & "; "
rsDC1.MoveNext
Loop
rsDC1.Close
Set rsDC1 = Nothing
DataConn.Close
Set DataConn = Nothing
Response.write GamArray
Next %>