Com Error while using OWC Chartcontrol

Posted by Gayathri under ASP.NET on 11/29/2011 | Points: 10 | Views : 2214 | Status : [Member] | Replies : 2
I am getting the following error while using the OWC.ChartspaceClass();

The err is
Retrieving the COM class factory for component with CLSID {0002E500-0000-0000-C000-000000000046} failed due to the following error: 80040154

please help.




Responses

Posted by: Blessyjees on: 11/29/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Could you provide your code.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gayathri on: 12/2/2011 [Member] Starter | Points: 25

Up
0
Down
I am sorry i am unable to attach it as zip from my system.
Here is the code.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OWC;
using Microsoft.Office.Interop;
using System.Xml;
using System.Data.SqlClient;

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["displayconnection"]);
cn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select pid, count(pid) from chart where month(time)=" + DropDownList1.SelectedItem.Value + " group by pid", cn);

da.Fill(ds);
//Testing
//Response.Write("ChartSpaceClass");

OWC.ChartSpaceClass oChartSpace = new OWC.ChartSpaceClass();

System.IO.StringWriter sw = new System.IO.StringWriter();
XmlDocument xDoc = new XmlDocument();
ds.WriteXml(sw);
// clean up
cn.Close();
da.Dispose();
ds.Dispose();
xDoc.LoadXml(sw.ToString());
sw.Close();
System.Xml.XmlNodeList nodes;
nodes = xDoc.ChildNodes.Item(0).ChildNodes;
int nCount = nodes.Count;
string[] aNames = new string[nCount];
string[] aTotals = new string[nCount];
string names = String.Empty;
string totals = String.Empty;
int i = 0;
for (i = 0; i < nCount; i++)
{
aNames[i] = nodes.Item(i).ChildNodes.Item(0).InnerText;
aTotals[i] = nodes.Item(i).ChildNodes.Item(1).InnerText;
}

names = String.Join("\t", aNames);
totals = String.Join("\t", aTotals);
oChartSpace.Charts.Add(0);
oChartSpace.Charts[0].SeriesCollection.Add(0);
oChartSpace.Charts[0].SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(OWC.ChartSpecialDataSourcesEnum.chDataLiteral), names);
oChartSpace.Charts[0].SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimValues,
Convert.ToInt32(OWC.ChartSpecialDataSourcesEnum.chDataLiteral), totals);
string strFullPathAndName = Server.MapPath("~/chart/" + System.DateTime.Now.Ticks.ToString() + ".gif");
oChartSpace.ExportPicture(strFullPathAndName, "gif", 800, 600);
string[] arr = new string[] { };
arr = strFullPathAndName.Split('\\');
Image1.Visible = true;
Panel1.Visible = true;
Image1.ImageUrl = "~/" + arr[arr.Length - 2] + "/" + arr[arr.Length - 1];
}
}

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response