F
fostejo
Hi,
I'm a newbie to the OWCs (and Web pages in general!) and despite a good
amount of playing around and digging into the helpfiles supplied, I'm
afraid I've gotten stuck on something I expected to be pretty simple..
I've got both OWC v9 & OWC v11 installed on my dev machine, which is
running a SQL database on IIS5. O/S is XP Pro.
My original intention was to use v9 of the Chart component at the
client side and while I've successfully managed to generate an
interactive chart from a table in my SQL database using it at the
client, due to limitations of the v9 chart control, I want to use the
v11 control instead. I'm aware of the lack of interactivity etc. doing
it this way, but there are other reasons I have for using the server
side components also.
Despite my best efforts, I'm struggling to convert the working OWC9
coding to use the Office 2003 components (v11) at the server - I
suspect it's something silly!
I've stripped the code down to the bare essentials for clarity. Listing
1 shows the working v9 client based code and listing 2 shows my
'conversion' to use the v11 OWCs at the server - this code fails with a
'VBScript runtime error '800a01ad' (ActiveX component can't create
object) at line 15 ("objDSC.RecordsetDefs.AddNew mySQL")
I've re-installed the Office 2003 web components without any joy and am
reasonable happy that the components are registered and working
correctly.
Any ideas as to the problem please?
Listing 1
<object id=objChartSpace
classid=CLSID:0002E500-0000-0000-C000-000000000046
style="width:100%;height:75%"></object> <!-- 2000 v9 -->
<object id=objDSC
classid=CLSID:0002E530-0000-0000-C000-000000000046></object>
<script language=vbscript>
SET c = objChartSpace.Constants
SET objChart=objChartSpace.Charts.Add()
objChart.Type = c.chChartTypeLine
objDSC.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=MyDBUSer;Initial Catalog=MyDB;Data Source=(local);"
mySQL="SELECT Date,Count,Location FROM MyTable WHERE
DATEDIFF(day,date,getdate())<90 ORDER BY Date"
objDSC.RecordsetDefs.AddNew mySQL
objChartSpace.DataSource = objDSC
objChart.SetData c.chDimSeriesNames, 0, "Location"
FOR EACH objSeries IN objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "Date"
objSeries.SetData c.chDimValues, 0, "Count"
NEXT
</script>
</body>
</html>
Listing 2
<%
adOpenStatic = 3
adUseClient = 3
SET objChartSpace = Server.CreateObject("OWC11.ChartSpace")
SET objDSC = Server.CreateObject("OWC11.DataSourceControl")
SET c = objChartSpace.Constants
SET objChart = objChartSpace.Charts.Add()
objChart.Type = c.chChartTypeLine
objDSC.ConnectionString="Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=MyDBUser;Initial Catalog=MyDB;Data Source=(local);"
mySQL="SELECT Date,Count,Location FROM MyTable WHERE
DATEDIFF(day,date,getdate())<90 ORDER BY Date"
objDSC.RecordsetDefs.AddNew mySQL
objChartSpace.DataSource = objDSC
objChart.SetData c.chDimSeriesNames, 0, "Location"
FOR EACH objSeries IN objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "Date"
objSeries.SetData c.chDimValues,0, "Count"
NEXT
RANDOMIZE()
strFileName = Server.MapPath(".") & "\Charts\" &
"tmpChart"+RIGHT(CSTR(1e6+rnd(1)*99999),5)&".gif"
objChartSpace.ExportPicture strFileName, "gif", 800, 400
Response.Write "<IMG SRC=""" & strFileName & """>" & "<P>"
%>
I'm a newbie to the OWCs (and Web pages in general!) and despite a good
amount of playing around and digging into the helpfiles supplied, I'm
afraid I've gotten stuck on something I expected to be pretty simple..
I've got both OWC v9 & OWC v11 installed on my dev machine, which is
running a SQL database on IIS5. O/S is XP Pro.
My original intention was to use v9 of the Chart component at the
client side and while I've successfully managed to generate an
interactive chart from a table in my SQL database using it at the
client, due to limitations of the v9 chart control, I want to use the
v11 control instead. I'm aware of the lack of interactivity etc. doing
it this way, but there are other reasons I have for using the server
side components also.
Despite my best efforts, I'm struggling to convert the working OWC9
coding to use the Office 2003 components (v11) at the server - I
suspect it's something silly!
I've stripped the code down to the bare essentials for clarity. Listing
1 shows the working v9 client based code and listing 2 shows my
'conversion' to use the v11 OWCs at the server - this code fails with a
'VBScript runtime error '800a01ad' (ActiveX component can't create
object) at line 15 ("objDSC.RecordsetDefs.AddNew mySQL")
I've re-installed the Office 2003 web components without any joy and am
reasonable happy that the components are registered and working
correctly.
Any ideas as to the problem please?
Listing 1
<object id=objChartSpace
classid=CLSID:0002E500-0000-0000-C000-000000000046
style="width:100%;height:75%"></object> <!-- 2000 v9 -->
<object id=objDSC
classid=CLSID:0002E530-0000-0000-C000-000000000046></object>
<script language=vbscript>
SET c = objChartSpace.Constants
SET objChart=objChartSpace.Charts.Add()
objChart.Type = c.chChartTypeLine
objDSC.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=MyDBUSer;Initial Catalog=MyDB;Data Source=(local);"
mySQL="SELECT Date,Count,Location FROM MyTable WHERE
DATEDIFF(day,date,getdate())<90 ORDER BY Date"
objDSC.RecordsetDefs.AddNew mySQL
objChartSpace.DataSource = objDSC
objChart.SetData c.chDimSeriesNames, 0, "Location"
FOR EACH objSeries IN objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "Date"
objSeries.SetData c.chDimValues, 0, "Count"
NEXT
</script>
</body>
</html>
Listing 2
<%
adOpenStatic = 3
adUseClient = 3
SET objChartSpace = Server.CreateObject("OWC11.ChartSpace")
SET objDSC = Server.CreateObject("OWC11.DataSourceControl")
SET c = objChartSpace.Constants
SET objChart = objChartSpace.Charts.Add()
objChart.Type = c.chChartTypeLine
objDSC.ConnectionString="Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=MyDBUser;Initial Catalog=MyDB;Data Source=(local);"
mySQL="SELECT Date,Count,Location FROM MyTable WHERE
DATEDIFF(day,date,getdate())<90 ORDER BY Date"
objDSC.RecordsetDefs.AddNew mySQL
objChartSpace.DataSource = objDSC
objChart.SetData c.chDimSeriesNames, 0, "Location"
FOR EACH objSeries IN objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "Date"
objSeries.SetData c.chDimValues,0, "Count"
NEXT
RANDOMIZE()
strFileName = Server.MapPath(".") & "\Charts\" &
"tmpChart"+RIGHT(CSTR(1e6+rnd(1)*99999),5)&".gif"
objChartSpace.ExportPicture strFileName, "gif", 800, 400
Response.Write "<IMG SRC=""" & strFileName & """>" & "<P>"
%>