G
Guest
Hi,
When the asp.net page is loading, i want to open a visio file (2007), change
the commandstring of a datarecordset in the visio file, export the visio file
to an image file (.png) and show the image on my asp.net page. But a get an
error:
Retrieving the COM class factory for component with CLSID
{00021A20-0000-0000-C000-000000000046} failed due to the following error:
80070003.
What is the reason of this error? How can i solve this?
The code i use:
Microsoft.Office.Interop.Visio.Application a = null;
Microsoft.Office.Interop.Visio.Document d = null;
try
{
a = new Microsoft.Office.Interop.Visio.Application();
a.Visible = false;
d = a.Documents.Open(VisioLoc);
d.DataRecordsets[1].DataConnection.ConnectionString =
"Provider=SQLOLEDB.1;Data Source=localhost;Initial
Catalog=DEMO2007-1;Integrated Security=SSPI;Persist Security Info=True";
d.DataRecordsets[1].CommandString = "select * from
dbo.UserObjectiveValues where UserId=" + UserId.ToString();
d.DataRecordsets[1].Refresh();
int UndoScopeID1 = a.BeginUndoScope("Refresh Data");
a.EndUndoScope(UndoScopeID1, true);
a.ActivePage.Export(ImageLoc);
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (d != null)
{
d.Save();
d.Close();
}
if (a != null) a.Quit();
}
Thanks,
Dennis
When the asp.net page is loading, i want to open a visio file (2007), change
the commandstring of a datarecordset in the visio file, export the visio file
to an image file (.png) and show the image on my asp.net page. But a get an
error:
Retrieving the COM class factory for component with CLSID
{00021A20-0000-0000-C000-000000000046} failed due to the following error:
80070003.
What is the reason of this error? How can i solve this?
The code i use:
Microsoft.Office.Interop.Visio.Application a = null;
Microsoft.Office.Interop.Visio.Document d = null;
try
{
a = new Microsoft.Office.Interop.Visio.Application();
a.Visible = false;
d = a.Documents.Open(VisioLoc);
d.DataRecordsets[1].DataConnection.ConnectionString =
"Provider=SQLOLEDB.1;Data Source=localhost;Initial
Catalog=DEMO2007-1;Integrated Security=SSPI;Persist Security Info=True";
d.DataRecordsets[1].CommandString = "select * from
dbo.UserObjectiveValues where UserId=" + UserId.ToString();
d.DataRecordsets[1].Refresh();
int UndoScopeID1 = a.BeginUndoScope("Refresh Data");
a.EndUndoScope(UndoScopeID1, true);
a.ActivePage.Export(ImageLoc);
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (d != null)
{
d.Save();
d.Close();
}
if (a != null) a.Quit();
}
Thanks,
Dennis