![](/img/trans.png)
[英]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.