我对SSRS很新颖,并且一直在传递参数。目前我正在做以下几点:如何在SSRS中传递参数
ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["serverPath"] + "MyReport";
List<ReportParameter> paralist = new List<ReportParameter>();
ReportParameter reportParam1 = new ReportParameter("LocationId", txtLocationId.Text);
ReportParameter reportParam2 = new ReportParameter("PrdAcctId", txtProductAccountId.Text);
ReportParameter reportParam3 = new ReportParameter("FromDate", frmdt);
ReportParameter reportParam4 = new ReportParameter("ToDate", todt);
ReportParameter reportParam5 = new ReportParameter("IntAmt", todt);
paralist.Add(reportParam1);
paralist.Add(reportParam2);
paralist.Add(reportParam3);
paralist.Add(reportParam4);
paralist.Add(reportParam5);
ReportViewer1.ServerReport.SetParameters(paralist);
这个工作正常,当没有。的参数设置。但在某些情况下,没有。的参数将在运行时根据用户输入来决定。
现在,我在如何使没有损失。在.rdl文件中灵活的参数。例如,根据用户输入可以有n个FromDate和ToDate以及相应的IntAmt。
我很感激任何帮助,并提前致谢。
检查这一个:http://stackoverflow.com/questions/3215350/ rdl-is-it-it-possible-have-optional-parameter-or-force-default-value-to-null –
以及另一个:http://bloggingabout.net/blogs/egiardina/archive/2007/06 /26/sql-server-reporting-services-optional-parameters.aspx –
感谢Davide的努力,但在我的情况下没有。的参数没有设置。传递null不是问题。用户可以只输入一个FromDate,ToDate和IntAmt,或者他可以输入几个。我想要的是访问所有这些是SSRS。我认为串联这些值然后将它们分解到SSRS可能会工作 – Arcturus