I'm new to rdlc and have a page that was created by an ex-employee of our company that I need to modify by adding a few more rdlc reports. So, I copied the report and changed the path to be dynamic. But I'm getting errors, such as
During the local report processing, an error occurred.
code is-
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();
}
There is an error in this line
During the processing of local reports, an error occurred.
this.TemprptViewer.LocalReport.SetParameters(new ReportParameter[] { p2 });
View the solution-
While Creating Report, make sure to add below two syntax. Also see the photo below.
DefaultLayout = RDLC; RDLCLayout = ‘Filename.rdl’;