将参数传递给RDLC报告时出错 [英] Error Passing Parameter to RDLC Report
问题描述
大家好。
我有一个带有文本框的表单和一个打开包含RDLC报告的表单的按钮。有没有办法将文本框中输入的值传递给RDLC报告以便使用它计算?
非常感谢任何帮助。
表单加载代码
this.reportViewer1.LocalReport.ReportEmbeddedResource =TestReport.Report1.rdlc;
ReportParameter rp = new ReportParameter(content,this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter [] {rp});
this.reportViewer1.RefreshReport();
----- -------------------------------------------------- --------
VS2010说
无法找到类型或命名空间名称''ReportParameter'(你是否缺少using指令或程序集)参考?)
------------------------------- --------------------------------
请帮忙..... >
提前感谢.... !!
正如此处提到的那样 [ ^ ],对于RDLC:
< pre lang =cs> ReportViewer1.LocalReport.ReportPath = 〜/ Report1.rdlc;
ReportParameter [] Parameters = new ReportParameter [ 1 ];
参数[ 0 ] = new ReportParameter( LastName,Convert.ToString(LastNameDropDownList.SelectedValue));
ReportViewer1.LocalReport.SetParameters(Parameters);
Hello to all.
I have a form with a textbox and a button that opens a form containing an RDLC report. Is there a way to pass the value entered in the text box to the RDLC report in order to use it calculations?
Thanks a lot for any kind help.
Form Load code
this.reportViewer1.LocalReport.ReportEmbeddedResource = "TestReport.Report1.rdlc";
ReportParameter rp = new ReportParameter("content", this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.reportViewer1.RefreshReport();
---------------------------------------------------------------
VS2010 says
The type or namespace name ''ReportParameter'' could not be found (are you missing a using directive or an assembly reference?)
---------------------------------------------------------------
Please Help.....
thanks in advance....!!
As mentioned here[^], for RDLC:
ReportViewer1.LocalReport.ReportPath ="~/Report1.rdlc"; ReportParameter[] Parameters = new ReportParameter[1]; Parameters[0] = new ReportParameter("LastName", Convert.ToString(LastNameDropDownList.SelectedValue)); ReportViewer1.LocalReport.SetParameters(Parameters);
这篇关于将参数传递给RDLC报告时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!