Printing a Crystal Report from the Web
Hopefully some one out there can tell me what I am doing wrong.
I am able to create a Crystal Report on a ASP.NET page. The report is connecting to SQL Server 2000 and running a stored procedure to get the data. All this works no problem. It all starts to go wrong when I try to export the file as a PDF file in order to print off the report. I can set up the code to do everything but as soon as I try the export method I get a 'Missing parameter field current value' error. Remove the export method it works fine. What am I doing wrong? My code is below. Thanks.
//create the strong typed report object
essentialReport = new EssentialReport();
this.essentialReport.SetDatabaseLogon(user, pass);
this.crTableLogonInfos = new TableLogOnInfos();
this.crTableLogonInfo = new TableLogOnInfo();
//connect to DWH and PLDWH
crCon = new ConnectionInfo();
crCon.ServerName = server;
crCon.DatabaseName = db;
this.crTableLogonInfo.ConnectionInfo = this.crCon;
this.crTableLogonInfo.TableName = "RangeCheck_EssentialReport";
this.crTableLogonInfos.Add(this.crTableLogonInfo);
//bind viewer to report
this.essentialReportViewer.LogOnInfo = this.crTableLogonInfos;
essentialReportViewer.ReportSource = this.essentialReport;
passReportParamenters();
fname = "c:\\Crystal\\CRNET\\"+Session.SessionID.ToString( )+".pdf";
this.crDiskFileDestinationOptions = new DiskFileDestinationOptions();
this.crDiskFileDestinationOptions.DiskFileName = this.fname;
this.essentialReport.ExportOptions.ExportDestinati onType = ExportDestinationType.DiskFile;
this.essentialReport.ExportOptions.ExportFormatTyp e = ExportFormatType.PortableDocFormat;
this.essentialReport.ExportOptions.DestinationOpti ons = this.crDiskFileDestinationOptions;
//passReportParamenters();
this.essentialReport.Export();
}
catch (LogOnException loe)
{
Session.Add("Error", loe.ToString());
Server.Transfer("Error.aspx");
}
}
|