ADO Database access - PROBLEM
Posted: Fri Dec 17, 2004 1:07 pm
hello,
I've tried to collect data from SQL Server 2000 and add the data directly to chart. I use ASP pages and ActiveX TeeChart version 6.0.0.5. The basic data fetch is as follows:
dim MyChart : set MyChart = Server.CreateObject("TeeChart.TChart")
dim data : set data = Server.CreateObject("ADODB.Connection")
dim record : set record = Server.CreateObject("ADODB.RecordSet")
data.open "DSN=xxx;Database=yyy;UID=uname;PWD=pwd", "", ""
for i=0 to Session("NoCircuits")-1
if circuit(i).plotI=1 then
strQuery="SELECT DateTime, OutValue FROM tblData WHERE CircuitNo=" & i & " AND Type='I' AND CaseID=" & Session("CaseID") & " AND MONTH(DateTime)=6 AND YEAR(DateTime)=YEAR(GETDATE())"
record.open strQuery,data,3,3
response.write record.RecordCount & "<br>"
MyChart.AddSeries(6)
MyChart.Series(seriesIndex).DataSource = Record
MyChart.Series(seriesIndex).YValues.ValueSource = "OutValue"
MyChart.Series(seriesIndex).LabelsSource = "DateTime"
MyChart.Series(seriesIndex).CheckDataSource
MyChart.Series(newSeries).VerticalAxisCustom = axCurrent
end if
next
In the example above I fetch current data for various circuits, and if the client has selected the current to be plotted (=circuit(x).plotI=1). I fetch the data from the database, and get 19 records (for example).
How can I set the data to Series0 (and further data to Series1, Series2, etc.)? When I load the page, the graph is empty. I need full example codes of how to do this.
I've tried to search the tutorials and manuals etc. but I cannot seem to add data to any series directly from database....
Thanks for any advises.
mike turner
I've tried to collect data from SQL Server 2000 and add the data directly to chart. I use ASP pages and ActiveX TeeChart version 6.0.0.5. The basic data fetch is as follows:
dim MyChart : set MyChart = Server.CreateObject("TeeChart.TChart")
dim data : set data = Server.CreateObject("ADODB.Connection")
dim record : set record = Server.CreateObject("ADODB.RecordSet")
data.open "DSN=xxx;Database=yyy;UID=uname;PWD=pwd", "", ""
for i=0 to Session("NoCircuits")-1
if circuit(i).plotI=1 then
strQuery="SELECT DateTime, OutValue FROM tblData WHERE CircuitNo=" & i & " AND Type='I' AND CaseID=" & Session("CaseID") & " AND MONTH(DateTime)=6 AND YEAR(DateTime)=YEAR(GETDATE())"
record.open strQuery,data,3,3
response.write record.RecordCount & "<br>"
MyChart.AddSeries(6)
MyChart.Series(seriesIndex).DataSource = Record
MyChart.Series(seriesIndex).YValues.ValueSource = "OutValue"
MyChart.Series(seriesIndex).LabelsSource = "DateTime"
MyChart.Series(seriesIndex).CheckDataSource
MyChart.Series(newSeries).VerticalAxisCustom = axCurrent
end if
next
In the example above I fetch current data for various circuits, and if the client has selected the current to be plotted (=circuit(x).plotI=1). I fetch the data from the database, and get 19 records (for example).
How can I set the data to Series0 (and further data to Series1, Series2, etc.)? When I load the page, the graph is empty. I need full example codes of how to do this.
I've tried to search the tutorials and manuals etc. but I cannot seem to add data to any series directly from database....
Thanks for any advises.
mike turner