Search code examples
asp.netc#-4.0visual-studio-2012crystal-reports

Why doesn't my Crystal Report Viewer display Results?


I am trying to develop a simple crystal report in ASP.NET and C#. I am using Crystal Report Viewer to Load my Report. Here's the C# code:

protected void Page_Load(object sender, EventArgs e)
{
    SqlConnection con;
    string connString = null;
    connString = "Data Source=.;initial catalog=InvoiceSystem;user id=sa;password=rfm";
    con = new SqlConnection(connString);
    con.Open();

    string query = null;
    query = "Select * from tblInvoice";
    SqlDataAdapter da = new SqlDataAdapter(query, con);
    con.Close();
    DataSetInv ds = new DataSetInv();
    da.Fill(ds, "tblInvoice");
    ReportDocument rpt = new ReportDocument();
    rpt.Load(Server.MapPath("~/CrystalReportInv.rpt"));
    rpt.SetDataSource(ds);
    CrystalReportViewer1.ReportSource = rpt;
}

The problem is that my CrystalReportViewer does not render my report on the browser; it's a blank page. Although there is no error, what could be wrong?


Solution

  • Below are the steps to resolve the issue

    1. Downloading and installing runtime for Crystal Reports 13 for Visual Studio 2010. (You might want to skip this step if you already did this before and your application is working locally).

    2. Once the runtime is installed. Crystal Reports will install the required support files in the location of your local computer: C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13

    3. Copy the entire Crystal Report Support folder C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13 to your Website's SITE_ROOT\aspnet_client\system_web\4_0_30319 folder.

    4) If you do not have a \aspnet_client\system_web\4_0_30319 folders in your website's root. Please create them manually and then copy the crystalreportviewers13 into it.

    Refer this Crystal Report is unable to find the required JavaScript (JS) files to render the report in browser