Crystal Server .NET integration Enterprise ReportDocument.Load Exception

0

I'm using Visual Studio 2010 with the various required plugins installed to communicate with SAP Crystal Server 2011. Everything is working fine and I can query data (e.g. return a list of folders within a folder) with no problems.

I'm trying to integrate this with the CrystalReportViewer component which appears to be working until I attempt to load the returned InfoObject into ReportDocument.Load. It always returns:

Unknown error 0x80040200.

Any ideas would be greatly appreciated. I'm at a bit of a loss. Other suggestions for how to do this I'll take on board as well.

Just to clarify. The Logon works fine, InfoObject is valid (the Response.Write returns the correct ID and Title of the Report).

SessionMgr ceSessionMgr = new SessionMgr();
EnterpriseSession ceSession = ceSessionMgr.Logon(ConfigurationManager.AppSettings["CrystalUser"].ToString(), ConfigurationManager.AppSettings["CrystalPassword"].ToString(), ConfigurationManager.AppSettings["CrystalServer"].ToString(), "Enterprise");
EnterpriseService ceEnterpriseService = ceSession.GetService("", "InfoStore");
InfoStore ceInfoStore = new InfoStore(ceEnterpriseService);

PluginManager cePluginMgr = ceInfoStore.PluginManager;
PluginInfo ceReportPlugin = cePluginMgr.GetPlugins("Desktop")["CrystalEnterprise.Report"];

InfoObjects ceInfoObjects = ceInfoStore.Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Report' AND SI_ID=" + Convert.ToInt32(Request["ReportID"]));

InfoObject ceInfoObject = ceInfoObjects[1];

Response.Write(ceInfoObject.ID.ToString() + " = " + ceInfoObject.Title + "<br/>");

CrystalDecisions.CrystalReports.Engine.ReportDocument ceReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
ceReportDocument.Load(ceInfoObject, ceSession);

CrystalReportViewer1.Visible = true;
CrystalReportViewer1.EnterpriseLogon = ceSession;
CrystalReportViewer1.ReportSource = ceReportDocument;
.net
visual-studio-2010
c#-4.0
crystal-reports-server
asked on Stack Overflow Nov 2, 2012 by Lee M

1 Answer

1

Had to work around this by using the RAS server instead. No idea why the above doesn't work because according to Docs it should.

// View the report using page server
PSReportFactory yPSReportFactory = (PSReportFactory)ceSession.GetService("PSReportFactory").Interface;
myReportSource = myPSReportFactory.OpenReportSource(ReportID);
//place the report source in session for use with postbacks
Session.Add("ReportSource", myReportSource);

CrystalReportViewer1.EnterpriseLogon = ceSession;
CrystalReportViewer1.ReportSource = myReportSource;
answered on Stack Overflow Nov 5, 2012 by Lee M

User contributions licensed under CC BY-SA 3.0