简体   繁体   中英

Crystal Report Is Not Showing data In Crystal Report Viewer Using VS 2013

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;
    }
}

I'm using crystal report manually. This is my .cs file code. Code showing no error but showing blank webpage on browser. don't able to find error......

下载支持VS2013的Crystal Report的最新版本,然后参考链接。

If you have installed the correct Crystal Run-times and you can debug reports, but not run them when hosted in IIS, the blank screen suggests you are dealing with this issue: Crystal Report with Visual studio 2013 aspnet_client/system_web/4_6_81

You can confirm this by opening F12 developer tools from your browser. You should notice some errors relating to missing JavaScript files like crv.js and some css from a folder like: C:\\inetpub\\wwwroot\\aspnet_client\\system_web\\4_XXXXXX.

It relates to automatic updates of the .Net Framework and how the Crystal Run-time references its static content. SAP is aware of this .

You can copy the folder as a temporary workaround: Copy C:\\inetpub\\wwwroot\\aspnet_client\\system_web\\4_0_30319 to C:\\inetpub\\wwwroot\\aspnet_client\\system_web\\4_6_XXXXX based on the path reported by the 404 errors in your developer tools.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM