c# - Microsoft 报表查看器 ASP.NET

标签 c# asp.net oracle datatable reportviewer

这是我第一次使用 Microsoft Report Viewer 控件,我认为它非常简单,但我不断收到以下错误:

 An error occurred during local report processing.
 The report definition for report 'Report3' has not been specified
 Object reference not set to an instance of an object.

我从我的 Oracle 数据库中看到我正在使用的 View 如下所示:

DataTable View

我浏览 GUI 并生成“新报告”并将此数据集添加到“表”。我使用查询生成器创建“FillByModel”和“GetDataByModel”函数,它们都从数据库返回正确的数据,但是当我运行我有 ReportViewer 控件的页面时,它给了我上述错误。我不知道那个错误是什么意思,在用谷歌搜索了这个错误并尝试了所有方法后,我不知道如何解决它。

这是我的 ReportViewer 对象的 .aspx 代码:

 <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
    <LocalReport ReportEmbeddedResource="Paint_Reporting.Report3.rdlc">
        <DataSources>
            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="LOL" />
        </DataSources>
    </LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnSelecting="ObjectDataSource1_Selecting" SelectMethod="GetData" TypeName="PaintModelNumberDetailTableAdapters.PAINT_MODELNUMBERDETAILLISTINGTableAdapter"></asp:ObjectDataSource>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

谁能帮我找出这个错误?

最佳答案

您必须在后面的代码中调用它:

reportViewer.LocalReport.ReportPath = "CommonLayer.Reports.SalesByPrice.rdlc";

只需确保相应地更改名称,即将 reportViewer.LocalReport.ReportPath 属性设置为 RDL 文件的路径。

这里有一个完整的讨论,详细说明了您必须解决此问题的选项:

The report definition for report 'xxx' has not been specified

关于c# - Microsoft 报表查看器 ASP.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12821487/

相关文章:

c# - 如何从 Windows Phone8 中的弹出窗口导航回来

c# - String.Empty、null、Length 或 String.IsEmptyOrNull?

c# - asp.net:发布应用程序后文本框消失

asp.net - 看不到 ASP.NET 应用程序的真实错误消息?

java - org.hibernate.hql.internal.ast.QuerySyntaxException : expecting CLOSE, 发现 '('

oracle - 使用 ODP.NET 从 PL/SQL 函数获取 RECORD,无需接触 PL/SQL 代码

c# - 检测符号链接(symbolic link)、连接点、挂载点和硬链接(hard link)

c# - 如何使用 C# 查询 NTP 服务器?

c# - 何时覆盖页面生命周期中的验证方法

java - 用于在 Java 中保存连接字符串参数的配置文件