error 80070003 while using Microsoft.office.Interop.visio

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,184
Latest member
ZNOChrista

Latest Threads

Top