【问题标题】:"The report definition for report 'xxx' has not been specified."“尚未指定报告‘xxx’的报告定义。”
【发布时间】:2013-09-29 23:27:16
【问题描述】:

我是第一次使用 ASP.Net 网络表单尝试 SSRS。

我创建了一个本地 RDLC 报告并在“默认”Web 表单中使用了 ReportViewer。在智能标签下,我选择了“选择报告”并选择了 RDLC 报告。

当我按 f5 运行报告时,即使我确实从智能标记中选择了报告,也会显示以下错误。

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

请告诉我为什么这没有按预期工作。

谢谢。

报告编码:

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
<section class="featured">
    <div class="content-wrapper">
        <hgroup class="title">
            <h1><%: Title %>.</h1>
            <h2>Modify this template to jump-start your ASP.NET application.</h2>
        </hgroup>
        <p>
            To learn more about ASP.NET, visit <a href="http://asp.net" title="ASP.NET Website">http://asp.net</a>.
            The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET.
            If you have any questions about ASP.NET visit <a href="http://forums.asp.net/18.aspx" title="ASP.NET Forum">our forums</a>.
        </p>
    </div>
</section>
</asp:Content>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="739px">
    <LocalReport ReportEmbeddedResource="WebApplicationFirstReports.Web Products.rdlc">
        <DataSources>
            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
        </DataSources>
    </LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="DataSetWebTableAdapters.DataTable1TableAdapter"></asp:ObjectDataSource>
</asp:Content>

【问题讨论】:

  • 你能分享你的代码吗?我知道如果放置“错误”,ReportViewer 会非常顽固。
  • 是的。我会将其作为问题的一部分。
  • 下面的答案是否回答了您的问题?
  • 谢谢。添加 ReportPath 使其找到报告。我不知道为什么它没有从设计师那里添加。
  • 有同样的问题。我发疯了,决定开始输入字母,看看会弹出什么,而 ReportPath 做了什么。所以我试了一下,它奏效了。只浪费了几个小时。

标签: asp.net visual-studio reporting-services webforms


【解决方案1】:

好的,您的本地报告中似乎缺少您的 ReportPath。这是直接来自我的工作项目的代码示例。

<body class="center">
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:Label ID="lblCheckDate" runat="server" Visible="False"></asp:Label>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="800px" Width="620px" CssClass="center" BackColor="White" ShowBackButton="False" ShowPageNavigationControls="False">
                <LocalReport ReportPath="Paystub.rdlc" ReportEmbeddedResource="PayrollApplication.Paystub.rdlc">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
                    </DataSources>
                </LocalReport>
            </rsweb:ReportViewer>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:pay %>"
                SelectCommand="SELECT * FROM [ViewPaychecks] WHERE ([CHKDATE] = @CHKDATE)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="lblCheckDate" Name="CHKDATE" PropertyName="Text" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </form>
</body>

如果这有帮助,请告诉我!我使用了 SqlDataSource 但这也应该与 ObjectDataSource 一起使用。

【讨论】:

    【解决方案2】:

    当您在实时站点中部署并且报告的.rdlc 文件尚未在站点中发布时会发生这种情况,因此这里是解决方案对我有用:

    1. 右键单击报告的“.rdlc”文件,选择属性,然后将 rdlc 的属性 Build Action 设置为 Content。

    屏幕截图:

    参考:

    This 和 This

    希望对您有所帮助。

    【讨论】:

      【解决方案3】:

      我收到了同样的错误消息,并通过在报告定义的末尾添加以下两 (2) 行来解决它:

      ReportViewer1.LocalReport.Refresh()
      ReportViewer1.RefreshReport()
      

      【讨论】:

        猜你喜欢
        • 2021-09-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多