C# 报表的报表定义';[报告名称]';尚未指定

C# 报表的报表定义';[报告名称]';尚未指定,c#,rdlc,C#,Rdlc,我正在尝试将reportviewer添加到我的WPF应用程序中。我已经按照上的步骤进行了操作,但现在我遇到了以下错误: 本地报表处理过程中出错。尚未指定报表“consegregator”的报表定义。对象引用未设置为对象的实例。 这是我的密码: private void Reportviewer_Load(object sender, EventArgs e) { if (!_IsReportViewerLoaded) { Micro

我正在尝试将reportviewer添加到我的WPF应用程序中。我已经按照上的步骤进行了操作,但现在我遇到了以下错误:

本地报表处理过程中出错。尚未指定报表“consegregator”的报表定义。对象引用未设置为对象的实例。

这是我的密码:

private void Reportviewer_Load(object sender, EventArgs e)
    {
        if (!_IsReportViewerLoaded)
        {
            Microsoft.Reporting.WinForms.ReportDataSource reportData = new Microsoft.Reporting.WinForms.ReportDataSource();
            Consolidated_DBDataSet conSet = new Consolidated_DBDataSet();
            conSet.BeginInit();

            reportData.Name = "ConSegSet";
            reportData.Value = conSet.Cnsldtd_Performance_tbl;
            this.reportViewer.LocalReport.DataSources.Add(reportData);
            this.reportViewer.LocalReport.ReportEmbeddedResource = "FP Reporting Dashboard.ConSegReport.rdlc";

            conSet.EndInit();

            Consolidated_DBDataSetTableAdapters.Cnsldtd_Performance_tbl_CLONETableAdapter conAD = new Consolidated_DBDataSetTableAdapters.Cnsldtd_Performance_tbl_CLONETableAdapter();
            conAD.ClearBeforeFill = true;
            conAD.Fill(conSet.Cnsldtd_Performance_tbl_CLONE);

            reportViewer.RefreshReport();

            _IsReportViewerLoaded = true;
        }
    }

我还将输出目录的.rdlc文件设置为“如果更新,则复制”。

我从未尝试引用嵌入式报告,始终是上载到SSRS的报告

这是我的代码,可能会有帮助:

IReportServerCredentials irsc = new CustomReportCredentials(rc.report_ssrs_username,
    rc.report_ssrs_password, rc.report_ssrs_domain);
ReportViewer1.ServerReport.ReportServerCredentials = irsc;
ReportViewer1.ServerReport.ReportPath = rc.report_ssrs_path;
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri(rc.report_ssrs_url);

SqlConnectionStringBuilder conString = new Database().conBuilder;
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("ConString", conString.ConnectionString));
ReportViewer1.ServerReport.SetParameters(parameters);
DataSourceCredentials dsc = new DataSourceCredentials();
dsc.Name = ReportViewer1.ServerReport.GetDataSources()[0].Name;
dsc.UserId = conString.UserID;
dsc.Password = conString.Password;
ReportViewer1.ServerReport.SetDataSourceCredentials(new DataSourceCredentials[] {
    dsc });

ReportViewer1.ShowCredentialPrompts = false;
ReportViewer1.ServerReport.Refresh();
IReportServerCredentials irsc=新的CustomReportCredentials(rc.report\u ssrs\u用户名,
rc.report\u ssrs\u密码,rc.report\u ssrs\u域);
ReportViewer1.ServerReport.ReportServerCredentials=irsc;
ReportViewer1.ServerReport.ReportPath=rc.report\u ssrs\u path;
ReportViewer1.ServerReport.ReportServerUrl=newsystem.Uri(rc.report\u ssrs\u url);
SqlConnectionStringBuilder consting=新建数据库().conBuilder;
列表参数=新列表();
添加(新的ReportParameter(“consting”,consting.ConnectionString));
ReportViewer1.ServerReport.SetParameters(参数);
DataSourceCredentials dsc=新的DataSourceCredentials();
dsc.Name=ReportViewer1.ServerReport.GetDataSources()[0].Name;
dsc.UserId=consting.UserId;
dsc.Password=consting.Password;
ReportViewer1.ServerReport.SetDataSourceRedentials(新的DataSourceRedentials[]{
dsc});
ReportViewer1.ShowCredentialPrompts=false;
ReportViewer1.ServerReport.Refresh();
如果你对我这里有什么问题,请告诉我。我们有一个表,它定义了我们所有的报表,并通过查询来动态呈现reportviewer控件

作为旁注,我将对RDLC文件使用下划线命名约定。如果解释不正确,可能会导致代码出错。另外,如果尝试从调试或发布目录引用文件,则尝试引用它将是一个完整路径,以验证这不是一个相对路径问题。

“FP Reporting Dashboard.ConSegReport.rdlc”将其更改为“FP\u Reporting\u Dashboard.ConSegReport.rdlc”