【问题标题】:ReportViewer databinding (WPF)ReportViewer 数据绑定 (WPF)
【发布时间】:2011-01-04 10:33:46
【问题描述】:

我有一个 rdlc 文件,我尝试使用 WPF 中的报表查看器控件显示它。我的数据源称为“OfficeDataSet”,报表中使用的数据集称为“地址”。我尝试像这样初始化报表查看器(我把它放在 WindowsFormsHost 中):

 private void PrepareReport()
    {
        reportDataSource = new ReportDataSource();
        officeDataSet = new OfficeDataSet();            
        adapter = new AddressTableAdapter();
        adapter.Fill(officeDataSet.Address);

        reportDataSource.Name = "OfficeDataSet_Address";
        reportDataSource.Value = officeDataSet.Address;
        viewerInstance.LocalReport.DataSources.Add(reportDataSource);
        viewerInstance.LocalReport.ReportEmbeddedResource = "WpfApplication1.Reports.TestReport.rdlc";
        viewerInstance.Location = new System.Drawing.Point(0, 0);

        viewerInstance.RefreshReport();
    }   

但我收到消息“尚未为数据源“地址”提供数据源实例”。 有人知道这段代码有什么问题吗? (我是 WPF 和 Reporting Services 的新手)。

【问题讨论】:

    标签: wpf reporting-services xsd datasource


    【解决方案1】:

    如果我没记错的话,报告文件中的数据源应该与 reportDataSource 具有相同的名称(或值)。因此,在您的报告文件中,数据源应称为“OfficeDataSet_Address”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-14
      • 1970-01-01
      • 2017-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-30
      • 2015-05-24
      相关资源
      最近更新 更多