Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am new to crystal reports. But i have designed the one crystal report by using help from google and asp.net forum. But after doing all the coding i am not able to view the crystal report after running through visual studio 2010. development environment (windows-7 32 bit,visual studio 2010 ,Crystal report V.13).
My aspx looks like below:

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReportSapco.aspx.cs" Inherits="ReportSapco" %>


<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>       
    <link href="8LcKSBVeHKaZoXGjmWViuQ==/Site.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-color:#E6E6FA;">
    <form id="form1" runat="server">
    
      <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
            <Report FileName="CertsReportSapco.rpt">
            </Report>
        </CR:CrystalReportSource>

    
    <div>
 
    <CR:CrystalReportViewer ID="ReportViewer" runat="server" 
            GroupTreeImagesFolderUrl="" Height="1269px" 
            ToolbarImagesFolderUrl="" ToolPanelWidth="120px" Width="100%" 
            EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" 
            HasCrystalLogo="false" hasToggleGroupTreeButton="false" BestFitPage="false"   
            ToolPanelView="None" BorderColor="#006699" BorderStyle="Solid" 
            BorderWidth="2px" HasToggleParameterPanelButton="False" 
            ReuseParameterValuesOnRefresh="True" HasSearchButton="False" 
            onload="ReportViewer_Load" ReportSourceID="CrystalReportSource1" onunload="ReportViewer_Unload" 
            />
     
    </div>
    </form>
</body>
</html>


And my aspx.cs looks like below:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Globalization;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;

public partial class ReportSapco : System.Web.UI.Page
{
    public static readonly string _ConStr = ConfigurationManager.ConnectionStrings["CStr"].ToString();
    public static void CheckDB()
    {
        using (var _con = new SqlConnection(_ConStr))
        {
            if (_con.State == ConnectionState.Open)
            {
                _con.Close();
            }
        }
    }


    private DSCertsSapco GetData(string query)
    {
        SqlCommand cmd = new SqlCommand(query);
        using (SqlConnection con = new SqlConnection(_ConStr))
        {
            using (SqlDataAdapter sda = new SqlDataAdapter())
            {
                cmd.Connection = con;
                sda.SelectCommand = cmd;
                using (DSCertsSapco dsCustomers = new DSCertsSapco())
                {
                    sda.Fill(dsCustomers, "TB_NewSapcoCerts");
                    return dsCustomers;
                }
            }
        }
    }

    protected void HomeBtn_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Default.aspx");
    }

    protected void BtnShowInfo_Click(object sender, EventArgs e)
    {

        string DateFrom = String.Format("{0}/{1}/01", GetCurYear(), DDownMonth.Text);
        string DateTo = String.Format("{0}/{1}/31", GetCurYear(), DDownMonth.Text);
        ReportDocument rpt = new ReportDocument();
        rpt.Load(Server.MapPath("CertsReportSapco.rpt"));
        DSCertsSapco dscerts = GetData("SELECT SuppCode,(SELECT SP_Name FROM TB_SupplierInfo WHERE (SP_Code=TB_NewSapcoCerts.SuppCode)) AS SuppName,PartNo,SerialNo,Code,PostedNo,(SELECT St_Name + ' ' + St_Family AS Expr1 FROM TB_StaffsInfo WHERE(St_PersCode=TB_NewSapcoCerts.SerialExporter)) AS SerialExporter,SerialIssuedDate,ID,SerialExporter as Perscode FROM TB_NewSapcoCerts where SerialExporter=N'" + int.Parse(Session["PersCode"].ToString()) + "' and suppcode='" + DDownSupp.Text + "' and SerialIssuedDate between '" + DateFrom + "' and '" + DateTo + "' and SerialStat<>6 order by SerialIssuedDate");
        if (dscerts.Tables[0].Rows.Count > 0)
        {
            rpt.SetDataSource(dscerts);
            rpt.SetParameterValue("Karfarma", "ساپکو");
            rpt.SetParameterValue("Mah", DDownMonth.Text);
            rpt.SetParameterValue("Personeli", Session["PersCode"].ToString());
            rpt.SetParameterValue("PersName", Session["PersName"].ToString());
            ReportViewer.ReportSource = rpt;
            ReportViewer.DataBind();
        }
        else
        {
            ReportDocument rpt2 = new ReportDocument();
            rpt2.Load(Server.MapPath("CertsReportSapco.rpt"));
            rpt2.SetDataSource("");
            rpt2.SetParameterValue("Karfarma", "");
            rpt2.SetParameterValue("Mah", "");
            rpt2.SetParameterValue("Personeli", "");
            rpt2.SetParameterValue("PersName", "");
            ReportViewer.ReportSource = rpt2;
        }

    }
    protected void SapcoPrint_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/ReportSaze.aspx");
    }
    protected void EpcoPrint_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/ReportEpco.aspx");
    }
    protected void ReportViewer_Load(object sender, EventArgs e)
    {
        string DateFrom = String.Format("{0}/{1}/01", GetCurYear(), DDownMonth.Text);
        string DateTo = String.Format("{0}/{1}/31", GetCurYear(), DDownMonth.Text);

        ReportDocument rpt = new ReportDocument();
        rpt.Load(Server.MapPath("~/CertsReportSapco.rpt"));
        DSCertsSapco dscerts = GetData("SELECT SuppCode,(SELECT SP_Name FROM TB_SupplierInfo WHERE (SP_Code=TB_NewSapcoCerts.SuppCode)) AS SuppName,PartNo,SerialNo,Code,PostedNo,(SELECT St_Name + ' ' + St_Family AS Expr1 FROM TB_StaffsInfo WHERE(St_PersCode=TB_NewSapcoCerts.SerialExporter)) AS SerialExporter,SerialIssuedDate,ID,SerialExporter as Perscode FROM TB_NewSapcoCerts where SerialExporter=N'" + int.Parse(Session["PersCode"].ToString()) + "' and suppcode='" + DDownSupp.Text + "' and SerialIssuedDate between '" + DateFrom + "' and '" + DateTo + "' and SerialStat<>6 order by SerialIssuedDate");
        if (dscerts.Tables[0].Rows.Count > 0)
        {
            rpt.SetDataSource(dscerts);
            rpt.SetParameterValue("Karfarma", "ساپکو");
            rpt.SetParameterValue("Mah", DDownMonth.Text);
            rpt.SetParameterValue("Personeli", Session["PersCode"].ToString());
            rpt.SetParameterValue("PersName", Session["PersName"].ToString());
            ReportViewer.ReportSource = rpt;
        }
        else
        {
            ReportDocument rpt2 = new ReportDocument();
            rpt2.Load(Server.MapPath("CertsReportSapco.rpt"));
            rpt2.SetDataSource("");
            rpt2.SetParameterValue("Karfarma", "");
            rpt2.SetParameterValue("Mah", "");
            rpt2.SetParameterValue("Personeli", "");
            rpt2.SetParameterValue("PersName", "");
            ReportViewer.ReportSource = rpt2;
        }
    }
    protected void ReportViewer_Unload(object sender, EventArgs e)
    {
        if (ReportViewer != null)
        {
           ReportViewer.ReportSource = null;
           ReportViewer.Dispose();
        }
    }
}


I debugged my code and i found that i am getting below error:

HasRecords = Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation crystal reports

I am getting this error for all the attributes after HasRecords for the ReportDocument.

I googled and found that something is going in infinite loop or all breakpoints should be removed to solve this error.

But to my observation nothing is in infinite loop for the above mentioned code and I removed all the breakpoints but no luck.

Will anyone help me to solve this error i am not able to see crystal report after running the code.

I am getting blank page and getting this error For ReportDocument.

What I have tried:

I set "PrintJobLimit" PROPERTY in registry = 250 and Enable 32-Applications on Application Pool in IIS = True

and i try this link but no solved

https://forums.asp.net/t/1986530.aspx?Hi+All+Please+Help+my+crystal+report+is+not+showing+any+data+after+running+the+report+
Posted
Updated 11-Sep-17 2:35am
v2
Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900