G
Guest
Hi,
Does anyone have any idea what I am doing wrong here. I have a SQL query
that pulls some data from a database and I want to display it as a graph.
Here is the code snippet:
Dim objChartspace, objChart, c, objConn, objRS, axis, sql
objChartspace = Server.CreateObject("owc11.Chartspace")
objConn = Server.CreateObject("OWC11.DataSourceControl")
objConn.ConnectionString = Application("AMS")
objChart = objChartspace.Charts.Add
c = objChartspace.Constants
objChart.Type = c.chChartTypeLine
objChart.HasLegend = True
sql = "Select Workgroup, day(lastModifiedOn) as entryMonth, count(*)
as _
entryTotals from vw_UnBilledEntries group by workgroup,
day(lastModifiedOn)"
objConn.RecordsetDefs.AddNew(sql)
objChartspace.DataSource = objRS
objChart.SetData(c.chDimSeriesNames, 0, "Workgroup")
objChart.SetData(c.chDimCategories, 0, "entryMonth")
objChart.SetData(c.chDimValues, 0, "entryTotals")
For Each axis In objChart.Axes
axis.HasTitle = True
If axis.Type = c.chCategoryAxis Then
axis.Title.Caption = "entryMonth"
Else
axis.Title.Caption = "entryTotals"
End If
Next
objChartspace.ExportPicture(Server.MapPath("/images/amschart"),
"gif", 600, 350)
Response.Write("<img src=""\images\amschart.gif"">")
However I get this error:
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Type
mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Source Error:
Line 55: sql = "Select Workgroup, day(lastModifiedOn) as entryMonth,
count(*) as entryTotals from vw_UnBilledEntries group by workgroup,
day(lastModifiedOn)"
Line 56: objConn.RecordsetDefs.AddNew(sql)
Line 57: objChartspace.DataSource = objRS
Line 58: objChart.SetData(c.chDimSeriesNames, 0, "Workgroup")
Line 59: objChart.SetData(c.chDimCategories, 0, "entryMonth")
Anyone have any words of wisdom?
Thanks,
Steve
Does anyone have any idea what I am doing wrong here. I have a SQL query
that pulls some data from a database and I want to display it as a graph.
Here is the code snippet:
Dim objChartspace, objChart, c, objConn, objRS, axis, sql
objChartspace = Server.CreateObject("owc11.Chartspace")
objConn = Server.CreateObject("OWC11.DataSourceControl")
objConn.ConnectionString = Application("AMS")
objChart = objChartspace.Charts.Add
c = objChartspace.Constants
objChart.Type = c.chChartTypeLine
objChart.HasLegend = True
sql = "Select Workgroup, day(lastModifiedOn) as entryMonth, count(*)
as _
entryTotals from vw_UnBilledEntries group by workgroup,
day(lastModifiedOn)"
objConn.RecordsetDefs.AddNew(sql)
objChartspace.DataSource = objRS
objChart.SetData(c.chDimSeriesNames, 0, "Workgroup")
objChart.SetData(c.chDimCategories, 0, "entryMonth")
objChart.SetData(c.chDimValues, 0, "entryTotals")
For Each axis In objChart.Axes
axis.HasTitle = True
If axis.Type = c.chCategoryAxis Then
axis.Title.Caption = "entryMonth"
Else
axis.Title.Caption = "entryTotals"
End If
Next
objChartspace.ExportPicture(Server.MapPath("/images/amschart"),
"gif", 600, 350)
Response.Write("<img src=""\images\amschart.gif"">")
However I get this error:
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Type
mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Source Error:
Line 55: sql = "Select Workgroup, day(lastModifiedOn) as entryMonth,
count(*) as entryTotals from vw_UnBilledEntries group by workgroup,
day(lastModifiedOn)"
Line 56: objConn.RecordsetDefs.AddNew(sql)
Line 57: objChartspace.DataSource = objRS
Line 58: objChart.SetData(c.chDimSeriesNames, 0, "Workgroup")
Line 59: objChart.SetData(c.chDimCategories, 0, "entryMonth")
Anyone have any words of wisdom?
Thanks,
Steve