2013-03-29 60 views
1

我不知道是什麼問題,我的筆記中有相同的代碼。報告查看器不會加載帶參數的.rdlc報告。我有相同的對象名稱和參數名稱。我在報告查看器的小箭頭鏈接中選擇了.rdlc報告。因此,請放心,它應該將.rdlc與報告查看器連接起來。我有以下代碼。如何在VS Visual Studio 2010 Basic中的報表查看器中加載帶有參數的.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 

末級

回答

0

而不是你的做法,嘗試使用reportparameter的列表。

創建列表,每個報表參數的對象添加到它,然後通過你的列表中

ReportViewer1.LocalReport.SetParameters() 

希望幫助!

相關問題