c# - Exception when ReportDocument is Exported, Saved, or Printed -
this 1 might tough 1 explain. i've got program fills in pre-built crystal report (cr 2011) based on oracle database. i've applied logon information tables in report (and tables in 5 sub reports) through msdn tutorial based code. if not add code report once it's refreshed (such saving it, or sending printer) run through code without issue. however, if add code makes program useful, breaks below exception.
here relevant code:
try { (intcount = 1; intcount < rname.count(); intcount++) { logfile.logmessage(path, sreportpath); logfile.logmessage(path, sreportpath + rname.elementat(intcount)); //this line loading "c:\...\policy reinstatement.rpt" valid cr.load(sreportpath + rname.elementat(intcount)); crconnectioninfo.servername = sdatasource; crconnectioninfo.databasename = ""; crconnectioninfo.userid = suserid; crconnectioninfo.password = spassword; cr.setdatabaselogon(crconnectioninfo.userid, crconnectioninfo.password, crconnectioninfo.servername, crconnectioninfo.databasename); //method looping through each table in report //and applying connection info each of them setdblogonforreport(crconnectioninfo, cr); //method looping through subreports, //then calling setdblogonforreport method. setdblogonforsubreports(crconnectioninfo, cr); crystalreportviewer rpt = new crystalreportviewer(); rpt.reportsource = cr; try { rpt.refresh(); } catch (exception ex) { //it not throw on exception logfile.logerror(path, ex); throw; } cr.printtoprinter(1, false, 0, 1); } } catch (exception ex) { //it throws on exception logfile.logerror(path, ex); throw; }
here exception:
message: failed open connection.policy reinstatement {35a94093-a135-462da5aa-f5fdd3e2d62b}.rpt source: crystaldecisions.reportappserver.datasetconversion stacktrace: @ crystaldecisions.reportappserver.convertdotnettoerom.throwdotnetexception(exception e) @ crystaldecisions.reportsource.eromreportsourcebase.handleexception(exception exception) @ crystaldecisions.reportsource.eromreportsourcebase.getlastpagenumber(reportpagerequestcontext reqcontext) @ crystaldecisions.crystalreports.engine.formatengine.printtoprinter(int32 ncopies, boolean collated, int32 startpagen, int32 endpagen) @ crystaldecisions.crystalreports.engine.reportdocument.printtoprinter(int32 ncopies, boolean collated, int32 startpagen, int32 endpagen) inner message: failed open connection. policy reinstatement {35a94093-a135-462d-a5aa-f5fdd3e2d62b}.rpt inner source: rptcontrollers.dll inner stacktrace: @ crystaldecisions.reportappserver.controllers.reportsourceclass.getlastpagenumber(requestcontext prequestcontext) @ crystaldecisions.reportsource.eromreportsourcebase.getlastpagenumber(reportpagerequestcontext reqcontext)
thanks in advance help.
Comments
Post a Comment