我已经猎杀并且明显错过了一步但却无法解决问题。在asp.net,.net framework 3.5上运行visual basic中的reportViewer。使用Visual Studio 2010 express,我有一个SSRS服务器,其中包含报告。每个报告都有5个参数。在SSRS报告本身中,它们被表示为多值下拉框,目前我的视觉基本每个参数只有一个值,直到我可以使实际报告工作!!
我的vb - 敏感数据被描述取代:
rptViewLeft.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
rptViewLeft.ServerReport.ReportServerUrl = New Uri("http://ourserver/Reportserver")
rptViewLeft.ServerReport.ReportPath = "/folder/reportName"
rptViewLeft.ShowParameterPrompts = False
rptViewLeft.ShowPrintButton = True
rptViewLeft.ShowExportControls = True
Dim areaName As New ReportParameter
Dim areaSecondNameAs New ReportParameter
Dim typeName As New ReportParameter
Dim subTypeName As New ReportParameter
Dim judgementName As New ReportParameter
Dim fromDate As New ReportParameter
Dim toDate As New ReportParameter
areaName.Name = "areaName"
areaSecondName.Name = "areaSecondName"
typeName.Name = "typeName"
subTypeName.Name = "subTypeName"
judgementName.Name = "judgementName"
fromDate.Name = "fromDate"
toDate.Name = "toDate"
areaName.Values.Add(drpareaName.SelectedValue)
areaSecondName.Values.Add(drpareaSecondName.SelectedValue)
typeName.Values.Add(drptypeName.SelectedValue)
subTypeName.Values.Add(drpsubTypeName.SelectedValue)
judgementName.Values.Add(drpjudgementName.SelectedValue)
fromDate.Values.Add(drpFromDate.SelectedValue)
toDate.Values.Add(drpToDate.SelectedValue)
rptViewLeft.ServerReport.SetParameters(New ReportParameter() areaName)
显然我在参数列表和'setParameters'位之间缺少一些东西 - 请有人建议这一步是什么?
答案 0 :(得分:1)
我意识到我错过了传递参数的数组。我还错过了VB文件顶部的以下行:
Imports system.collections.generic
'toDate.Values.Add(drpToDate.SelectedValue)'行后添加的数组部分是:
Dim parameters As New List(Of ReportParameter)
parameters.Add(areaName)
parameters.Add(areaSecondName)
parameters.Add(typeName)
parameters.Add(subTypeName)
parameters.Add(judgementName)
parameters.Add(fromDate)
parameters.Add(toDate)
rptViewLeft.ServerReport.SetParameters(parameters)
现在运行正常。