private ReportDocument boReportDocument = null;
ConnectionInfo connectionInfo = newConnectionInfo();
if (IsPostBack) // post back event, check if report is in session if it is view it.
{
boReportDocument = (ReportDocument)Session["Report"]; // Now send the report to the viewer
CrystalReportViewer1.ReportSource = boReportDocument;
Session["Report"] = null;
CrystalReportViewer1.RefreshReport();
}
if (Session["Report"] == null) // Report is not in session (previously loaded) so load report, set params, view and place in session
{
//boReportDocument = new ReportDocument();
boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
//string rptFile = ((BaseApplicationPage)(this.Page)).Decrypt(this.Page.Request.QueryString["Name"]);
string rptFile = this.Page.Request.QueryString["Name"];
//string Newreport = this.Page.Request.QueryString["Newreport"];
this.Page.Title = this.Page.Request.QueryString["Name"].Replace(".rpt", "");
boReportDocument.Load(Server.MapPath("~/Crystal/" + rptFile));
Session.Add("Report", boReportDocument);
CrystalReportViewer1.ReportSource = boReportDocument;
connectionInfo.DatabaseName = "XXXX";
connectionInfo.UserID = "XXXX";
connectionInfo.Password = "XXXX";
connectionInfo.ServerName = "XXXX";
TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
else // Report is already loaded and in session so use it also means we never reload the report
{
boReportDocument = (ReportDocument)Session["Report"]; // Now send the report to the viewer
CrystalReportViewer1.ReportSource = boReportDocument;
}
this is part of my code, what do I need to change for my code in order to solve the problem?
thanks
Kelvni