在setparameters中进行本地报表处理时发生错误

时间:2013-08-14 06:17:05

标签: vb.net reportviewer rdlc

我正在尝试处理本地报告,但在setparameters中遇到错误。 这是示例代码。

r.ProcessingMode = ProcessingMode.Local

    Dim lr As LocalReport = r.LocalReport

    lr.ReportEmbeddedResource = "Gy.Report1.rdlc"

'注释报告为空白。

    Dim dss As New DataSet
    Dim daa As New SqlDataAdapter("select * from c_inventory", cn)
    cn.Open()
    daa.Fill(dss, "c_inventory")
    cn.Close()

    Dim dss1 As New ReportDataSource
    dss1.Name = "c_inventory"
    dss1.Value = dss.Tables("c_inventory")

    lr.DataSources.Add(dss1)
    r.RefreshReport()


    'Create a report parameter for the sales order number 
    Dim rpfilled As New ReportParameter()
    rpfilled.Name = "filled"
    rpfilled.Values.Add("0")


    Dim param() As ReportParameter = {rpfilled}
    lr.SetParameters(param)

1 个答案:

答案 0 :(得分:0)

我通常在本地处理模式下设置报告参数,所以

Dim p As New ReportParameter("myParameterName", param1.ToString())
rptViewer.LocalReport.SetParameters(New () {p})

因此,请尝试将最后两行更改为

Dim param As New ReportParameter("yourReportParametername", rpfilled)
lr.LocalReport.SetParameters(New () {param})