日期:2014-05-19  浏览次数:20414 次

rdlc报表:定义了报表参数,如何给它赋值呢?
如题

------解决方案--------------------
ReportViewer1.ShowParameterPrompts = false;
//string ReportServerUrl = System.Configuration.ConfigurationManager.AppSettings[ "ReportServerUrl "].ToString();
//ReportViewer1.ServerReport.ReportServerUrl = new Uri(ReportServerUrl);

ReportParameter Myyear = new ReportParameter();
ReportParameter Mymonth = new ReportParameter();
ReportParameter Myvalue = new ReportParameter();
ReportParameter Mytype = new ReportParameter();
ReportParameter Director_Id = new ReportParameter();

Myyear.Name = "Myyear ";
Myyear.Values.Add(Request.QueryString[ "myyear "].ToString());

Mymonth.Name = "Mymonth ";
Mymonth.Values.Add(Request.QueryString[ "mymonth "].ToString());

Myvalue.Name = "Myvalue ";
Myvalue.Values.Add(Request.QueryString[ "myvalue "].ToString());

Mytype.Name = "Mytype ";
Mytype.Values.Add(Request.QueryString[ "mytype "].ToString());

Director_Id.Name = "Director_Id ";
Director_Id.Values.Add(Request.QueryString[ "Director_Id "].ToString());

ReportViewer1.ProcessingMode = ProcessingMode.Local;

ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Myyear });
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Mymonth });
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Myvalue });
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Mytype });
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Director_Id });

ReportViewer1.LocalReport.Refresh();