【问题标题】:Retrieve Parameters from RDLC从 RDLC 检索参数
【发布时间】:2014-05-04 10:32:42
【问题描述】:

如何从 RDLC 本地报告中检索报告参数

LocalReport localReport = (LocalReport)e.Report;
ReportParameterInfoCollection ps = new ReportParameterInfoCollection();
ps = localReport.GetParameters();
ReportParameter paramV = new ReportParameter();

我想在“paramV”中保存一个特定参数及其值

【问题讨论】:

标签: c# asp.net ssrs-2012 rdlc


【解决方案1】:

在下钻报告中,我使用此代码获取参数并将其发送到下一个数据源:

        LocalReport localReport = (LocalReport)e.Report;
        //Get all the parameters passed from the main report to the target report.  
        //OriginalParametersToDrillthrough actually returns a Generic list of   
        //type ReportParameter.  

        IList<ReportParameter> list = localReport.OriginalParametersToDrillthrough;

        DataTable DT = new DataTable();

                string org = null;
                string status = null;

                //Parse through each parameters to fetch the values passed along with them.  
                foreach (ReportParameter param in list)
                {
                    if (param.Name == "org")
                        org = param.Values[0].ToString();
                    else if (param.Name == "status")
                        status = param.Values[0].ToString();
                }

        // Request the datatable from ADO.NET for example or any source that will need the parameters

         var dataSet1 = new DataSets.xx.yy();

          if (string.IsNullOrEmpty(org) && string.IsNullOrEmpty(status))
              DT = dataSet1.GetAllData();
          else
              DT = dataSet1.GetDataByOrgStatus(org, status);

        localReport.DataSources.Add(new ReportDataSource("DSName", DT));
        localReport.Refresh();

【讨论】:

    猜你喜欢
    • 2011-07-01
    • 2014-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多