SQL 报告:报告查看器控件不显示数据
Posted
技术标签:
【中文标题】SQL 报告:报告查看器控件不显示数据【英文标题】:SQL Reporting: Report viewer control not showing data 【发布时间】:2011-01-28 09:28:16 【问题描述】:我有一个使用 SQL Server 报告查看器的应用程序,它显示一些服务器报告。在 Visual Studio 下调试应用程序时,我能够运行 Aspx 应用程序并查看报告。但是当我发布 web 应用程序并尝试查看报表时,报表控件不会呈现报表数据。我只能看到报表控件的过滤器部分和 ViewReport 按钮。单击按钮后,会发生回发,并且应用的每个过滤器都会重置。
我也可以通过报表服务器的报表管理器查看报表。我想知道当我将应用程序托管到服务器时,是什么阻止了报表查看器。
我正在使用 IIS 6.0、SQLServer 2005、Visual Studio 2005 (ASP 2.0) 和 Report Viewer 8.0
以下是我在页面中使用的代码
protected void Page_Load(object sender, EventArgs e)
string svrRep = ConfigurationManager.AppSettings["ReportServerURI"].ToString();
this.rptViewer.ServerReport.ReportServerUrl = new Uri(svrRep);
if (!Page.IsPostBack)
this.rptViewer.ServerReport.ReportPath = "/MyReportFolder/My_Report";
这是报表查看器的标记
<div style="width: 1095px; height:600px">
<rsweb:ReportViewer ID="rptViewer" runat="server" Font-Names="Arial" Font-Size="8pt" SizeToReportContent="true"
Height="100%" ProcessingMode="Remote" Width="100%" BackColor="Silver" BorderColor="#666666" >
<ServerReport ReportServerUrl="" />
</rsweb:ReportViewer>
</div>
请大家帮我解决这个问题。
【问题讨论】:
【参考方案1】:也许设置 Reportserver 会重置控件,尝试将这些行移入
(!Page.IsPostBack)
括号。
【讨论】:
【参考方案2】:我遇到了同样的问题,报告不显示数据(显示 0 页,共 0 页)。
我在这里找到了解决方案:
Report Viewer Control not displaying data when deployed IIS7
我按照说明安装了可再发行组件并添加了处理映射,并且成功了。
希望这对其他人有所帮助。
【讨论】:
以上是关于SQL 报告:报告查看器控件不显示数据的主要内容,如果未能解决你的问题,请参考以下文章