Skip to Content
0
Former Member
Aug 11, 2009 at 03:22 PM

.COMException: The document has not been opened (Windows 7, IIS 7, ASP.NET)

2189 Views

Hi all,

I updated my PC to Windows 7 last night and just finished reinstalling all of my software including CR2008 with all of the latest service packs.

I can't seem to get any of my report documents to load in my ASP.NET applications and I can't figure out why.

All I get is:

System.Runtime.InteropServices.COMException: The document has not been opened

It fails on the very first line of the load process:

using (ReportDocument doc = new ReportDocument()) {

String path = Server.MapPath(aiSettings.siteRoot + "/reports/incident_report.rpt");

ExportFormatType f = ExportFormatType.PortableDocFormat;

doc.Load(path);

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = ConfigurationManager.AppSettings["crystal_dsn"].ToString();

Tables tables = doc.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) {

TableLogOnInfo tableLogonInfo = table.LogOnInfo;

tableLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(tableLogonInfo);

}

doc.DataDefinition.RecordSelectionFormula = "{ai_vew_incident_printout.id} IN [235274];";

doc.ExportToHttpResponse(f, Response, true, "ir_expt_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day);

}

Even if I clean out the entire function and JUST have the using statement, it still fails.. so something is happening when the report document object is created and I don't know where to turn from here.

Any thoughts?

Edited by: RussellMD on Aug 11, 2009 5:25 PM