簡體   English   中英

無法將數據源綁定到reportViewer

[英]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”提供數據源實例

什么可能是錯誤?

  1. 以文本形式打開rdlc文件
  2. First_Year_IT_AttendanceBindingSource替換DataSet1

檢查rdlc中的列(字段)是否與數據源中的列“相等”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM