我手动创建了一个数据集,里面有一个数据表。我想用代码值添加到这个数据表中的列,并在报表中显示它们。但我得到了不同的错误。
在我的RDLC文件中,我有一个名为companyReportBudget
的数据源和一个名为Report
的数据集。这个数据集有companyReportBudget
作为数据源,reportBudget
作为可用数据集。
这是我在表单中用来填充DataTable并在报表中显示它的代码:
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()
字符串
但是在Dim rds As New ReportDataSource("Report", rptBudget)
行中,ReportDataSource
被下划线表示为错误。
错误表示:
重载解析失败,因为没有可访问的“New”接受此数量的类型参数。
我认为错误与rptBudget
变量有关。
你有什么建议?
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条答案
按热度按时间olhwl3o21#
根据要求添加了reportBudgetDataTable定义:
字符串