Crystal .NET上没有显示Crystal报表 [英] Crystal report not showing on ASP .NET
问题描述
我问的是一个常见的问题(抱歉)。我有很多例子,但我无法解决我的错误。我的问题是,我想在我的网页上显示水晶报告(使用visual studio 2010 - asp .Net& c#),但它是空白的(没有错误发生)。我注意到有几篇文章有同样的问题,但我没有弄清楚确切的问题。请帮我找出问题所在。在此先感谢。
我尝试过:
在网上.config
Hi, I am asking a common problem (and sorry for this). I got lots of example, but I am not able to fix my error. My problem is, I want to show crystal report on my web page (using visual studio 2010 - asp .Net & c#), but it is coming blank (no error occur). I noticed several article with same issue, but I fail to figure out exact problem. Please help me to find out the problem. Thanks in advance.
What I have tried:
On web.config
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
<assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</buildProviders>
<handlers>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
</handlers>
On .asp Page
On .asp Page
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<CR:CrystalReportViewer ID="crv_Report" runat="server" Height="550px" Width="350px" AutoDataBind="True" />
On .cs页面
On .cs Page
DataTable _Data = Get_Data();
ReportDocument _rpt = new ReportDocument();
_rpt.Load(Server.MapPath("CrystalReport.rpt"));
_rpt.SetParameterValue("Report_Data", "Hello! How are you?");
_rpt.SetDataSource(_Data);
crv_Report.ReportSource = _rpt;
crv_Report.DataBind();
推荐答案
最快的方法是找出为什么它不显示是使用调试器来进入你的代码。
三个可能的问题:
(1)如果你验证RPT文件指向正确的位置。
(2)验证您在RPT中设置的DataSource。在你的情况下_Data。是否有返回的行?
(3)验证您在RPT中传递的参数是否匹配。
这是一个我在谷歌上发现了几个关于如何在ASP.NET中使用Crytal报告的教程:
如何在ASP.NET Webforms中创建Crystal Reports [^]
在ASP.Net中创建Crystal Reports报告
The quickest way is figure out why it's not displaying is to use the debugger to step into your code.
Three possible issues:
(1) Verify the RPT file if you are pointing to the correct location.
(2) Verify DataSource that you set in your RPT. In your case the _Data. Does it have a rows returned?
(3) Verify the parameter that you passed in your RPT if it matched.
Here are a couple of tutorials I found on google on how to work with Crytal Reports in ASP.NET:
How to Create Crystal Reports in ASP.NET Webforms[^]
Create Crystal Reports Report in ASP.Net
这篇关于Crystal .NET上没有显示Crystal报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!