2013-02-07 76 views
1

這是我的VB.NET(2012)代碼,用於顯示基於Combobox(cmbCustomer)的報告,我想在報告上打印該參數cmbCustomer.text報告中的打印參數

Private Sub btnShow_Click(sender As Object, e As EventArgs) Handles btnShow.Click 
     Me.rpt_customerByDateTableAdapter.Fill(Me.customerByDateDataSet.rpt_customerByDate, 
     cmbCustomer.Text) 
     Me.ReportViewer1.RefreshReport() 
End Sub 

回答

0

這裏是怎麼了,假設你已經在創造了一個參數你rldc

Dim customer As String = cmbCustomer.text 
Dim CustomerParam As New ReportParameter("yourCustomerParameter", customer) 

Dim reportParameters() As ReportParameter = {CustomerParam} 

Me.DataTable1TableAdapter.Fill(Me.customerByDateDataSet.rpt_customerByDate, 
     cmbCustomer.Text) 

Me.ReportViewer1.LocalReport.SetParameters(reportParameters) 
Me.ReportViewer1.RefreshReport() 
+0

非常感謝您的幫助,我想Me.rpt_customerByDateTableAdapter.LocalReport.SetParameters(reportParameters)必須Me.ReportViewer1 .LocalReport.SetParameters(reportParameters) – imsome1

+0

是的,它只是一個例子,我更新了我的答案':)' – spajce