1

我打了又打,显然错过了一步,但无法弄清楚是什么。在 asp.net、.net framework 3.5 上以 Visual Basic 运行 reportViewer。使用 Visual Studio 2010 express,我有一个报告所基于的 SSRS 服务器。每个报告包含 5 个参数。在 SSRS 报告本身中,它们表示为多值下拉框,目前我拥有每个参数只有一个值的 Visual Basic,直到我可以让实际报告正常工作!

我的 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”位之间遗漏了一些东西 - 请有人能告诉我这一步是什么?

4

1 回答 1

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)

现在运行良好。

于 2013-06-20T07:50:04.213 回答