Crystal Report 不显示在使用 VS 2013 构建的 ASP.net 网页中

Crystal Report doesnt display in ASP.net webpage which is build by using VS 2013(Crystal Report 不显示在使用 VS 2013 构建的 ASP.net 网页中)

本文介绍了Crystal Report 不显示在使用 VS 2013 构建的 ASP.net 网页中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ASP.NET 开发一个网站,我想在我的网络表单中显示一个报告.我使用水晶报表作为我的报告工具.我使用 Visual Studio 2013 作为我的 IDE.这是我尝试过的.(我的 SAP 版本是 13.0.9).

I am developing a website using ASP.NET and I want to display a report in my webform. I am using crystal report as my reporting tool. I am using visual studio 2013 as my IDE. This what I have tried. (My SAP version is to 13.0.9).

private void loadReport()
    {
        ReportDocument rpt = new ReportDocument();
        rpt.Load("D:\Report_Test.rpt");
        rpt.VerifyDatabase();

        CrystalReportViewer1.ReportSource = rpt;

    }

上面的代码在 Visual Studio 2010 上运行良好,但在 2013 年却不行.当我加载页面时它是空的.不抛出任何错误.那么,如何使用 Visual Studio 2013 查看 Crystal Report 呢?

above code works fine with visual studio 2010 but not in 2013. When I load the page it is empty. Not throwing any errors. so, How can view Crystal Report using Visual Studio 2013 ?.

推荐答案

首先要检查的是报表查看器客户端文件是否可用,我怀疑这是你的问题(你可能会发现它在默默地抛出一个 javascript 错误!).在 IIS 中它应该已经创建了一个虚拟目录,如果 IIS express,那么你需要手动移动查看器需要的文件,以下应该可以工作:

The first thing to check,is whether the report viewer clientside files are available, I suspect that's your issue (you may find it's silently throwing a javascript error!). In IIS it should have created a virtual directory, if IIS express, then you'll need to move the files the viewer needs manually, the following should work:

在应用程序的根目录中创建一个名为 crystalreportviewers13 的文件夹,将文件夹 C:Program Files (x86)SAP BusinessObjectsCrystal Reports for .NET Framework 4.0CommonCrystal Reports 2011crystalreportviewers 的内容复制到该文件夹​​中文件夹(源路径在不同的机器上似乎有所不同).

Create a folder called crystalreportviewers13 folder in the root your application, copy the contents of the folder C:Program Files (x86)SAP BusinessObjectsCrystal Reports for .NET Framework 4.0CommonCrystal Reports 2011crystalreportviewers into that folder (the source path seems to vary on different machines).

将此添加到 web.config 的配置部分

Add this to the configsections of your web.config

<configSections>
<sectionGroup name="businessObjects">
  <sectionGroup name="crystalReports">
    <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
    <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
  </sectionGroup>
</sectionGroup>

然后将其添加到 web.config 的配置部分

Then add this into the configuration section of your web.config

<businessObjects>
<crystalReports>
  <rptBuildProvider>
    <add embedRptInResource="true" />
  </rptBuildProvider>
  <crystalReportViewer>
    <add key="ResourceUri" value="/crystalreportviewers13" />
   </crystalReportViewer>
</crystalReports>
</businessObjects>

它应该可以工作....

And it should work....

我会先从这里下载最新版本 http://scn.sap.com/docs/DOC-7824

I'd first download the latest version from here http://scn.sap.com/docs/DOC-7824

如果仍然没有显示,请检查您的 web.config 是否指向正确的版本.如果您仍然遇到问题,请检查您的 HTML 声明中的文档类型 - 我记得它不适用于 HTML5.

If it still doesn't display check your web.config is pointing at the right version. If you've still got problems, then check the doc type in your HTML declaration - as I recall it doesn't work properly with HTML5.

在 Crystal 的早期版本中,我上面提到的那个文件夹会自动复制到 c:inetpubwwwrootaspnet_clientsystem_web4_0_30319 - 如果您将整个 aspnet_client 复制到解决问题的应用程序的根目录中 - 在后面水晶的版本我相信如果您在安装时没有运行 IIS,它无论如何都不会创建该文件夹.

In earlier versions of crystal that folder I mentioned above is automatically copied into c:inetpubwwwrootaspnet_clientsystem_web4_0_30319 - if you copy the whole aspnet_client into the root of your application that resolved the issue - in the later versions of crystal I believe that if you don't have IIS running when you install it doesn't create that folder anyway.

这篇关于Crystal Report 不显示在使用 VS 2013 构建的 ASP.net 网页中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Crystal Report 不显示在使用 VS 2013 构建的 ASP.net 网页中