Unable to populate RDLC from DataSet

69 Views Asked by At

I manually created a DataSet with a DataTable inside. I would to add with the code values to columns in this DataTable and show them in a Report. But I get different errors.

In my RDLC file I have a DataSource named companyReportBudget and a Dataset named Report. This dataset has companyReportBudget as DataSource and reportBudget as Available Dataset.

This is the code that I used in my form to fill the DataTable and show it in the report:

Dim rptBudget As New companyReportBudget.reportBudgetDataTable

rptBudget.Clear()


For Each rowBudget As RequestGetBudget In rowsBudget

    Dim reportRow As DataRow = rptBudget.NewRow()

    reportRow("num") = rowBudget.number
    reportRow("code") = rowBudget.code

    rptBudget.Rows.Add(reportRow)
Next

Dim rds As New ReportDataSource("Report", rptBudget)
rptStampaBudget.RefreshReport()

But in line Dim rds As New ReportDataSource("Report", rptBudget) the ReportDataSource is underlined as error.

The error says:

Overload resolution failed because no accessible 'New' accepts this number of type arguments.

And I think that the error is related to rptBudget variable.

What do you suggest?

SYSTEM DETAILS:
OS: Windows 10 Pro (22H2)
Visual Studio: Community 2017 Version 15.9.55

NUGET PACKAGES:
Microsoft.ReportViewer.WinForms.v12 - 12.0.0.1
Microsoft.ReportingServices.ReportViewerControl.Winforms - 150.1586.0
1

There are 1 best solutions below

0
Swim89 On

reportBudgetDataTable definition added as requested:

<xs:element name="companyReportBudget" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="companyReportBudget" msprop:Generator_UserDSName="companyReportBudget">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="reportBudget" msprop:Generator_TableClassName="reportBudgetDataTable" msprop:Generator_RowEvArgName="reportBudgetRowChangeEvent" msprop:Generator_TableVarName="tablereportBudget" msprop:Generator_TablePropName="reportBudget" msprop:Generator_RowDeletingName="reportBudgetRowDeleting" msprop:Generator_RowChangingName="reportBudgetRowChanging" msprop:Generator_RowEvHandlerName="reportBudgetRowChangeEventHandler" msprop:Generator_RowDeletedName="reportBudgetRowDeleted" msprop:Generator_UserTableName="reportBudget" msprop:Generator_RowChangedName="reportBudgetRowChanged" msprop:Generator_RowClassName="reportBudgetRow">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="number" msprop:Generator_ColumnVarNameInTable="columnumber" msprop:Generator_ColumnPropNameInRow="number" msprop:Generator_ColumnPropNameInTable="numberColumn" msprop:Generator_UserColumnName="number" type="xs:string" minOccurs="0" />
              <xs:element name="code" msprop:Generator_ColumnVarNameInTable="columncode" msprop:Generator_ColumnPropNameInRow="code" msprop:Generator_ColumnPropNameInTable="codeColumn" msprop:Generator_UserColumnName="code" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>