问题描述
环境如题,两个RadioButton5、6,并为Reportviewer添加不同的rdlc,并传递相同的参数,代码如下:IfRadioButton6.Checked=TrueThenReportViewer1.Reset()ReportViewer1.LocalReport.ReportPath="Report_1.rdlc"ElseIfRadioButton5.Checked=TrueThenReportViewer1.Reset()ReportViewer1.LocalReport.ReportPath="Report_2.rdlc"EndIfDimrepAsNewMicrosoft.Reporting.WinForms.ReportDataSource("syDataSet_z_data",rs.Tables(0))ReportViewer1.LocalReport.DataSources.Clear()ReportViewer1.LocalReport.DataSources.Add(rep)Me.ReportViewer1.RefreshReport()Dimtemp_year_rq1AsNewMicrosoft.Reporting.WinForms.ReportParameter("year_rq1",year_rq1)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_year_rq1})Dimtemp_year_rq2AsNewMicrosoft.Reporting.WinForms.ReportParameter("year_rq2",year_rq2)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_year_rq2})Dimtemp_month_rq1AsNewMicrosoft.Reporting.WinForms.ReportParameter("month_rq1",month_rq1)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_month_rq1})Dimtemp_month_rq2AsNewMicrosoft.Reporting.WinForms.ReportParameter("month_rq2",month_rq2)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_month_rq2})Dimtemp_jeAsNewMicrosoft.Reporting.WinForms.ReportParameter("je",money)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_je})Dimtemp_rq1AsNewMicrosoft.Reporting.WinForms.ReportParameter("rq1",rq1)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_rq1})Dimtemp_rq2AsNewMicrosoft.Reporting.WinForms.ReportParameter("rq2",rq2)ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_rq2})Me.ReportViewer1.RefreshReport()
运行时在为RDLC指定参数的第一行报错,提示:本地报表处理出错,求教高手啊,如何解决?谢谢!
解决方案
解决方案二:
自己顶一下!
解决方案三:
解决方案四:
引用2楼happy09li的回复:参照版主建议进行了修改,但还是不成功。是在进行参数传递时进行报错,ReportViewer1.LocalReport.SetParameters(NewMicrosoft.Reporting.WinForms.ReportParameter(){temp_year_rq1})可有其它建议??