asp.net 无法生成rdlc报告

kb5ga3dv  于 2022-12-24  发布在  .NET
关注(0)|答案(1)|浏览(148)

我是新的rdlc,我有一个页面,这是由我们公司的前雇员开发的,我必须通过添加一些rdlc报告来修改它。所以,我复制粘贴报告,并使路径动态。但我得到错误,即,
本地报表处理期间出错。
这是我的代码。

if (oDataSet.Tables.Count > 0)
{
   oDataSet.Tables.Add(oDataTable);
   ReportDataSource rd = new ReportDataSource("Letter", oDataSet.Tables[0]);
   ReportDataSource rd1 = new ReportDataSource("DataSet1", oDataSet.Tables[1]);
   this.TemprptViewer.LocalReport.DataSources.Clear();
   this.TemprptViewer.LocalReport.DataSources.Add(rd);
   this.TemprptViewer.LocalReport.DataSources.Add(rd1);
   ReportParameter p2 = new ReportParameter("CurrentDate", DateTime.Today.ToString("MMMM dd, yyyy"));
   this.TemprptViewer.LocalReport.SetParameters(new ReportParameter[] { p2 });
   ReportParameter Reimbrs_payAnnual = new ReportParameter("Reimbrs_payAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["Reimbrs_payAnnual"].ToString()), 0).ToString());
   ReportParameter basicAnnual = new ReportParameter("basicAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["basicAnnual"].ToString()), 0).ToString());
   ReportParameter hraAnnual = new ReportParameter("hraAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["hraAnnual"].ToString()), 0).ToString());
   ReportParameter spl_allowAnnual = new ReportParameter("spl_allowAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["spl_allowAnnual"].ToString()), 0).ToString());
   ReportParameter tran_allowAnnual = new ReportParameter("tran_allowAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["tran_allowAnnual"].ToString()), 0).ToString());
   ReportParameter statutory_bonusAnnual = new ReportParameter("statutory_bonusAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["statutory_bonusAnnual"].ToString()), 0).ToString());
   ReportParameter fixed_grossAnnual = new ReportParameter("fixed_grossAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["fixed_grossAnnual"].ToString()), 0).ToString());
   ReportParameter Medi_ReimbursAnnual = new ReportParameter("Medi_ReimbursAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["Medi_ReimbursAnnual"].ToString()), 0).ToString());
   ReportParameter LTAAnnual = new ReportParameter("LTAAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["LTAAnnual"].ToString()), 0).ToString());
   ReportParameter Total_ReimburseAnnual = new ReportParameter("Total_ReimburseAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["Total_ReimburseAnnual"].ToString()), 0).ToString());
   ReportParameter pfAnnual = new ReportParameter("pfAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["pfAnnual"].ToString()), 0).ToString());
   ReportParameter gratuityAnnual = new ReportParameter("gratuityAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["gratuityAnnual"].ToString()), 0).ToString());
   ReportParameter total_retiral_benifitAnnual = new ReportParameter("total_retiral_benifitAnnual", Math.Round(Double.Parse(oDataSet.Tables[0].Rows[0]["total_retiral_benifitAnnual"].ToString()), 0).ToString());
   ReportParameter ctcWords = new ReportParameter("ctcWords", ctcWord);
   this.TemprptViewer.LocalReport.SetParameters(new ReportParameter[] { basicAnnual, hraAnnual, spl_allowAnnual, tran_allowAnnual, statutory_bonusAnnual, fixed_grossAnnual, Medi_ReimbursAnnual, LTAAnnual, Total_ReimburseAnnual, pfAnnual, gratuityAnnual, total_retiral_benifitAnnual, ctcWords, Reimbrs_payAnnual });
   page.Session["GridBind"] = "a";
   this.TemprptViewer.LocalReport.Refresh();
}

该行出现错误
本地报表处理期间出错

this.TemprptViewer.LocalReport.SetParameters(new ReportParameter[] { p2 });
bxfogqkk

bxfogqkk1#

确保ReportViewer不为空

填充报表数据源和报表数据示例
报表检视器
1-选择报表查看器任务
2-选择数据源
3-填充报表数据源
4-填充报表数据示例

相关问题