我创建了包含一个表从我的SQL数据库名为“BillHeaders”的ReportViewer缺少数据源
这里是我的报表浏览器是什么样子,它将包含两份报告的数据集。一个包含工作编号和说明,另一个包含工作编号,说明和合同编号。
这里是我的按钮,将执行要么报告
这里是我的报告,我在“报告”的文件夹。两者都构建并准备好去。
Unfortuantely当我使用此代码(分别为每个按钮):
Private Sub btnJobNoDesc_Click(sender As System.Object, e As System.EventArgs) Handles btnJobNoDesc.Click
'Reset the viewer
frmReportViewer.ReportViewer1.Reset()
'Dim the required datasources. Need a seperate ReportDatasource for each table in the report
Dim ReportDataSource1 As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
'Give datasource name and set the specific datatables
ReportDataSource1.Name = "dsBillHeaders_BillHeaders"
ReportDataSource1.Value = frmReportViewer.dsBillHeaders.BillHeaders
'Clear the datasources in the report and add the new ones
frmReportViewer.ReportViewer1.LocalReport.DataSources.Clear()
frmReportViewer.ReportViewer1.LocalReport.DataSources.Add(ReportDataSource1)
frmReportViewer.ReportViewer1.LocalReport.ReportEmbeddedResource = "ReportViewer_Tutorial.rptJobNoDesc.rdlc"
frmReportViewer.ReportViewer1.RefreshReport()
frmReportViewer.Show()
End Sub
我得到这样的结果:
我在做什么毛病我的数据源?
是“dsBillHeaders”数据集名称吗?或表名。 – PatFromCanada 2013-02-20 12:51:02
dsBillHeaders是Tablix的数据集名称:) – Alex 2013-02-20 14:30:23