[英]How to bind dynamically datasource to reportviewer on windows forms c#
[英]Unable to bind datasource to reportViewer
我有一個使用reportViewer
的C#應用程序。 我想在一個reportViewer
添加3個報告。 以下是單個報告的代碼:
ReportDataSource rds = new ReportDataSource();
this.reportViewer1.LocalReport.DataSources.Clear();
if (comboBoxReports.SelectedIndex == 0)
{
reportViewer1.Reset();
reportViewer1.LocalReport.ReportPath = "D:\\AMOS\\WindowsFormsApplication1\\WindowsFormsApplication1\\Report2.rdlc";
rds.Name = "First_Year_IT_AttendanceBindingSource";
rds.Value = this.First_Year_IT_AttendanceBindingSource;
reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.RefreshReport();
}
但是,當我運行我的應用程序時,我收到以下錯誤
尚未為數據源“DataSet1”提供數據源實例
什么可能是錯誤?
檢查rdlc中的列(字段)是否與數據源中的列“相等”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.