【发布时间】:2023-03-24 13:37:02
【问题描述】:
我有一个带有两个参数的SSRS 2005 报告。 CountID 参数是一个查询值 (From query)。我使用以下方法从 ASP.Net 2.0 调用此报告,它工作正常。
window.location.href= strRepServer + strReport + "&rc:Parameters=false&rs:ClearSession=true&plantcd=" + strPlantCD + "&CountID=" + strCountID;
请注意,我们只从 ASPX 页面为参数 CountID 传递一个字符串值。仍然可以正常工作。
现在,我使用以下代码修改了代码以使用 reportviewercontrol。但是当报告呈现时,它会显示“'CountID' 参数缺少值”。我已经提到了以下两个帖子 - 但它没有帮助。知道如何使它工作吗?
- Pass Multi value parameter to SSRS from UI
- Passing a Multi-value parameter to the ReportViewer control
注意:我知道如果我将 CountID 设为 non-queried 或将其设为文本框将解决问题。但是我需要在不更改rdl 文件的情况下使代码正常工作。 [原因是 rdl 在以前的方法中工作正常(在没有报告查看器的情况下调用报告)]
代码
rvInvalidPackageSKUs.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
rvInvalidPackageSKUs.ServerReport.ReportServerUrl = New Uri("http://myserver/ReportServer/")
rvInvalidPackageSKUs.ServerReport.ReportPath = "/MyFolder/SubFolder/MyReport"
Dim rpPlant As New ReportParameter
rpPlant.Name = "plantcd"
rpPlant.Values.Add("23")
'Dim rpCountID As New ReportParameter
'rpCountID.Name = "CountID"
'rpCountID.Values.Add("1")
Dim rpCountID As ReportParameter
rpCountID = New ReportParameter("CountID")
Dim valuesArray As String() = New String() {"x", "y", "z"}
rpCountID.Values.AddRange(valuesArray)
Dim paramList As New Generic.List(Of ReportParameter)
paramList.Add(rpPlant)
paramList.Add(rpCountID)
rvInvalidPackageSKUs.ServerReport.SetParameters(paramList)
rvInvalidPackageSKUs.ServerReport.Refresh()
RDL 中的参数
【问题讨论】:
标签: c# asp.net .net vb.net reporting-services