M
Mick Turner
I have connected to SQL Server database (server-side vbscript) and read some
data from the tables. This works correctly. I now have the data in an array
(server-side).
I have to draw a line-chart based on that data, for which purpose I need to
create client-side component (this works also perfectly).
PROBLEM: I cannot use the server-side array for drawing the chart.
Here's the code shortly:
<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Graph</title>
</head>
<%
Session.Timeout = 10
Response.Expires = -1000
Dim objConn, objRS, strQuery
Dim objRS2, strQuery2
Dim strConnection
Dim dataArray(999)
Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "DSN=LocalServer;Database=ASPTest;UID=sa;PWD=;"
objConn.Open strConnection
'count number of records
strQuery = "SELECT Count(*) AS recCount FROM tblCurrent"
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strQuery, objConn, 3, 3
Response.Write(objRS("recCount") & "<br><br>")
'read the firstname and the lastname
strQuery2 = "SELECT * FROM tblCurrent"
set objRS2 = Server.CreateObject("ADODB.Recordset")
objRS2.Open strQuery2, objConn, 3, 3
for i = 0 to (objRS("recCount")-1)
dataArray(i) = objRS2("fCurrent")
Response.Write (dataArray(i) & "<br>")
objRS2.movenext
next
objConn.Close
set objConn = nothing
%>
<script language="vbscript">
function updateData()
TChart1.AddSeries(asFastLine)
TChart1.Series(0).Clear
TChart1.Zoom.Enable = true
TChart1.Legend.CheckBoxes = true
with TChart1
.Zoom.Animated = true
.Zoom.AnimatedSteps = 5
end with
TChart1.Series(0).AddArray 9, array1
end function
</script>
<body>
<input type="button" value="Example" name="btnChart" onClick="updateData()"
style="position:absolute;top:550px;left:10px">
<OBJECT classid="clsid:536600D3-70FE-4C50-92FB-640F6BFC49AD"
codebase="TeeChart6.ocx#version=6,0,0,0"
id=TChart1
TYPE="application/x-oleobject"
width=500
height=400
align=center
hspace=0
vspace=0
style="position:absolute;top:100px;left:100px">
</OBJECT>
</body>
</html>
Anyone know, how to use the server-side array in my client-side code for
drawing the chart?
TIA
Mike
data from the tables. This works correctly. I now have the data in an array
(server-side).
I have to draw a line-chart based on that data, for which purpose I need to
create client-side component (this works also perfectly).
PROBLEM: I cannot use the server-side array for drawing the chart.
Here's the code shortly:
<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Graph</title>
</head>
<%
Session.Timeout = 10
Response.Expires = -1000
Dim objConn, objRS, strQuery
Dim objRS2, strQuery2
Dim strConnection
Dim dataArray(999)
Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "DSN=LocalServer;Database=ASPTest;UID=sa;PWD=;"
objConn.Open strConnection
'count number of records
strQuery = "SELECT Count(*) AS recCount FROM tblCurrent"
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strQuery, objConn, 3, 3
Response.Write(objRS("recCount") & "<br><br>")
'read the firstname and the lastname
strQuery2 = "SELECT * FROM tblCurrent"
set objRS2 = Server.CreateObject("ADODB.Recordset")
objRS2.Open strQuery2, objConn, 3, 3
for i = 0 to (objRS("recCount")-1)
dataArray(i) = objRS2("fCurrent")
Response.Write (dataArray(i) & "<br>")
objRS2.movenext
next
objConn.Close
set objConn = nothing
%>
<script language="vbscript">
function updateData()
TChart1.AddSeries(asFastLine)
TChart1.Series(0).Clear
TChart1.Zoom.Enable = true
TChart1.Legend.CheckBoxes = true
with TChart1
.Zoom.Animated = true
.Zoom.AnimatedSteps = 5
end with
TChart1.Series(0).AddArray 9, array1
end function
</script>
<body>
<input type="button" value="Example" name="btnChart" onClick="updateData()"
style="position:absolute;top:550px;left:10px">
<OBJECT classid="clsid:536600D3-70FE-4C50-92FB-640F6BFC49AD"
codebase="TeeChart6.ocx#version=6,0,0,0"
id=TChart1
TYPE="application/x-oleobject"
width=500
height=400
align=center
hspace=0
vspace=0
style="position:absolute;top:100px;left:100px">
</OBJECT>
</body>
</html>
Anyone know, how to use the server-side array in my client-side code for
drawing the chart?
TIA
Mike