private void LoadReport() { string key = Request.QueryString["key"]; CacheReportData data = new SystemCache().GetCache(key) as CacheReportData; if (data == null) { //加载一个默认的报表,提示当前报表打开失败 } else { BaseReport report = ReadReport(data.ReportID); XtraReport xtraReport = XtraReport.FromStream(report.getReportStream(), true); foreach (DefineSqlParameter par in report.DataSource.DbParameterCollection) { if (par.ParameterName.ToUpper() == "ID".ToUpper()) { par.Value = data.QueryKey; } } report.DataSource.Fill(); xtraReport.DataSource = report.DataSource; this.ReportViewer1.Report = xtraReport; //xtraReport.CreateDocument(); } }
private void OpenReport(BaseReport report) { if (report == null) { return; } xtraReport = XtraReport.FromStream(report.getReportStream(), true); this.xtraReport.DataSource = report.DataSource; this.ReportViewer1.Report = this.xtraReport; }