【问题标题】:How can I load the .rdlc report with parameters in the report viewer in VS Visual Studio 2010 Basic?如何在 VS Visual Studio 2010 Basic 的报表查看器中加载带有参数的 .rdlc 报表?
【发布时间】:2013-12-04 00:17:28
【问题描述】:

我不知道是什么问题,我的笔记中有相同的代码。报表查看器不会加载带有参数的 .rdlc 报表。我有相同的对象名称和参数名称。我在报告查看器的小箭头链接中选择了 .rdlc 报告。所以请放心,它应该将 .rdlc 与报告查看器连接起来,我有以下代码。

导入 Microsoft.Reporting.WinForms

公共类 PrintSingleInfo

Private Sub PrintSingleInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim pn, bn, ad, cn, sr, lt, lb, ls, ln, dd, lp, pc, tb, dp, tp, dr, ir, mp, pt As New ReportParameter
    pn = New ReportParameter("PNPANoPar", MemParkInfoSysForm.PNPANoTextBox.Text)
    bn = New ReportParameter("BuyerNamePar", MemParkInfoSysForm.BuyerNameTextBox.Text)
    ad = New ReportParameter("AddressPar", MemParkInfoSysForm.AddressTextBox.Text)
    cn = New ReportParameter("ContactNoPar", MemParkInfoSysForm.ContactTextBox.Text)
    sr = New ReportParameter("SalesRepPar", MemParkInfoSysForm.SalesRepTextBox.Text)
    lt = New ReportParameter("TypePar", MemParkInfoSysForm.TypeCBO.Text)
    ls = New ReportParameter("SectionPar", MemParkInfoSysForm.SectionTextBox.Text)
    lb = New ReportParameter("BlockPar", MemParkInfoSysForm.BlockTextBox.Text)
    ln = New ReportParameter("LotNoPar", MemParkInfoSysForm.LotNoTextBox.Text)
    dd = New ReportParameter("DueDatePar", MemParkInfoSysForm.DueUpDown.Value)
    lp = New ReportParameter("LotPricePar", MemParkInfoSysForm.LBLPrice.Text)
    pc = New ReportParameter("PerpetualCarePar", MemParkInfoSysForm.LBLPerpCare.Text)
    tp = New ReportParameter("TotalLotPricePar", MemParkInfoSysForm.LBLTotLotPrice.Text)
    dp = New ReportParameter("DownPaymentPar", MemParkInfoSysForm.DownpaymentTextBox.Text)
    tb = New ReportParameter("LotBalancePar", MemParkInfoSysForm.LBLLotBal.Text)
    pt = New ReportParameter("PaymentTermsPar", MemParkInfoSysForm.PaymentTermsCBO.Text)
    ir = New ReportParameter("InterestRatePar", MemParkInfoSysForm.LBLInterest.Text)
    dr = New ReportParameter("DiscountRatePar", MemParkInfoSysForm.LBLDiscount.Text)
    mp = New ReportParameter("MonthlyPaymentPar", MemParkInfoSysForm.LBLMonthly.Text)



    ReportViewer1.LocalReport.SetParameters(pn)
    ReportViewer1.LocalReport.SetParameters(bn)
    ReportViewer1.LocalReport.SetParameters(ad)
    ReportViewer1.LocalReport.SetParameters(cn)
    ReportViewer1.LocalReport.SetParameters(sr)
    ReportViewer1.LocalReport.SetParameters(lt)
    ReportViewer1.LocalReport.SetParameters(ls)
    ReportViewer1.LocalReport.SetParameters(lb)
    ReportViewer1.LocalReport.SetParameters(ln)
    ReportViewer1.LocalReport.SetParameters(dd)
    ReportViewer1.LocalReport.SetParameters(lp)
    ReportViewer1.LocalReport.SetParameters(pc)
    ReportViewer1.LocalReport.SetParameters(tp)
    ReportViewer1.LocalReport.SetParameters(dp)
    ReportViewer1.LocalReport.SetParameters(tb)
    ReportViewer1.LocalReport.SetParameters(pt)
    ReportViewer1.LocalReport.SetParameters(ir)
    ReportViewer1.LocalReport.SetParameters(dr)
    ReportViewer1.LocalReport.SetParameters(mp)
    Me.ReportViewer1.RefreshReport()
End Sub

结束类

【问题讨论】:

    标签: parameters report rdlc


    【解决方案1】:

    尝试使用报告参数列表,而不是您的方法。

    创建列表,将每个报表参数对象添加到其中,然后将列表传递给

    ReportViewer1.LocalReport.SetParameters()
    

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-15
      • 2014-05-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      相关资源
      最近更新 更多