Crystal 报表未在使用 VS 2013 的 Crystal 报表查看器中显示数据


using CrystalDecisions.CrystalReports.Engine;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection("Data Source=DESKTOP;Initial Catalog=TestDB;Integrated Security=True");
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ReportDocument doc = new ReportDocument();
            doc.Load(Server.MapPath("~/UserList.rpt"));
            DataSetSample ds = getdata();
            doc.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = doc;
        }
    }
    public DataSetSample getdata()//.xsd file
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from tblUser", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSetSample ds = new DataSetSample();
        da.Fill(ds, "DataTable1");
        return ds;
    }
}

我正在手动使用水晶报告。这是我.cs文件代码。代码显示没有错误,但在浏览器上显示空白网页。找不到错误...

下载最新版本的水晶报告,支持VS2013,然后参考此链接。

如果已安装正确的 Crystal 运行时,并且可以调试报表,但在 IIS 中承载时不能运行它们,则空白屏幕表明您正在处理此问题: Crystal Report with Visual Studio 2013 aspnet_client/system_web/4_6_81

可以通过从浏览器打开 F12 开发人员工具来确认这一点。您应该注意到一些与缺少JavaScript文件(如crv(相关的错误.js以及来自以下文件夹的一些css:C:\inetpub\wwwroot\aspnet_client\system_web\4_XXXXXX。

它涉及.Net Framework的自动更新以及Crystal Runtime如何引用其静态内容。SAP 意识到了这一点。

您可以将该文件夹复制为临时解决方法:根据开发人员工具中 404 错误报告的路径,将 C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 复制到 C:\inetpub\wwwroot\aspnet_client\system_web\4_6_XXXXX。