Report.rdlc not displaying parameterized report

Jul 23 2009 10:38 PM
I have created a windows application with a combo box filled with countries from NorthWnd database. A typed dataset is created which contains a method called GetCustomersByCountry() to fetch the records for a specific country selected from combo box.

A report1.rdlc is created to display the records.

The problem is when I select a country from Combo box, the report viewer is unable to display the records.

The following code is written in the selectedindex event of combobox.

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim adapter As New NorthWndTableAdapters.CustomersTableAdapter
        ReportViewer1.LocalReport.ReportPath = "Report1.rdlc"
        Dim rds As New ReportDataSource()
        rds.Name = "NorthWnd_Customers"
        rds.Value = adapter.GetCustomersByCountry(Combobox1.Text)
        ReportViewer1.LocalReport.DataSources.Add(rds)
        Me.ReportViewer1.RefreshReport()
    End Sub

But when I call the method GetCustomerByCountry("UK") it display the records.

Now, anyone can suggest me please why the reportviewer not display the records when I select a country from Combo Box.

Thanks


Answers (2)