Carisle
Carisle

Reputation: 467

Report Viewer Problems

I have an error how to fix this thanks in advance:) the datasource1 shows overload resolution failed because no accessible 'new' is more specific for there arguments.

    ReportViewer1.Visible = True

    Dim thisDataSet As New DataSet()

    Dim adapCategory As DataSetParameterTableAdapters.mCategoryTableAdapter = New DataSetParameterTableAdapters.mCategoryTableAdapter
    Dim ds As DataSetParameter.mCategoryDataTable = New DataSetParameter.mCategoryDataTable()
    adapCategory.Fill(ds, Me.DropDownList1.SelectedValue)

    Dim datasource1 As New ReportDataSource("DataSetParameter_mCategory", ds)
    ReportViewer1.LocalReport.DataSources.Clear()
    ReportViewer1.LocalReport.DataSources.Add(datasource1)

    ReportViewer1.LocalReport.Refresh()

Upvotes: 1

Views: 227

Answers (1)

user596075
user596075

Reputation:

That's because your ds instance of the DataSet object does not match the requirements for the ReportDataSource(String, Object) constructor. See this MSDN reference for that constructor.

Also, quoting the remarks from that link:

Value may be an instance of DataTable, a IEnumerable value (for example, DataView or Array), or a IDataSource.

The problem is you're trying to pass a DataSet object, and that is neither a DataTable, nor does it implement IEnumerable or IDataSource.

In other words, you can't pass a DataSet object to this constructor. The solution would be to pull the appopriate DataTable out of that DataSet and pass that DataTable instance to the constructor.

Upvotes: 1

Related Questions