Link to home
Start Free TrialLog in
Avatar of AnandSahoo
AnandSahoo

asked on

Using Crystal Report XI in Visual Studion 2008

Hi Team,

Facing little problem in integrating crystal report with asp.net.

I have a windows 2008 R2 server.
Visual Studio 2008 professional edition installed which support Crystal Report.
I also have Crystal Report XI software installed separately.

I used to develope crystal report using crystal report software separately, not in vs2008.where parameter in record selection is like
{open_date} >= {?startdate} and {open_date} <= {?end_date}

Below is my code to display a parameter based crystal report in web page.

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace MISC.Reports
{
    public partial class Reopen_report : System.Web.UI.Page
    {
        protected void Page_load(object sender, EventArgs e)
        {
            ReportDocument report = new ReportDocument();
            report.Load("D:\\Reports\\Reopen_Tickets.rpt");
            report.SetDatabaseLogon("user", "password");            
            Reopen_Report.ReportSource = report;
            Reopen_Report.RefreshReport();
        }

Problems I am facing:-

1. While loading in webpage,it shows the parameter screen first. After parameter input it is very very slow. When I use Crystal report software and use the same report it is faster.

Solutions tried -

        Added Reportsource ID
        Uninstalled crystal XI software

But still the same issue
       


2. The report shows the data after 3 to 4 minutes. After that when I try any action on the crystal toolbar like export,print,next page etc ( Important is export), It is doing a post back and coming back toparameter screen again. Report disappears.

Solution Tried :-
      changed the page_load to page_init  --  After that it does not show the export pop up at all. It is like loading loading and done.

     Added postback code as below both using page_load and page_init and Session variable.

protected void Page_load(object sender, EventArgs e)
        {
if(!page.ispostback)
{
            ReportDocument report = new ReportDocument();
            report.Load("D:\\Reports\\Reopen_Tickets.rpt");
            report.SetDatabaseLogon("user", "password");  
           Session.Add("report1",report);        
            Reopen_Report.ReportSource = report;
            Reopen_Report.RefreshReport();
        }
else
{
Reopen_Report.ReportSource = Session["report1"];
            Reopen_Report.RefreshReport();
}
}

But still the same issue.

Can you help me to resolve these 2 issues please ?
Avatar of Mike McCracken
Mike McCracken

You don't want to refresh the report.  Doing that, Crystal assumes you want to prompt for new parameters.

mlmcc
Avatar of AnandSahoo

ASKER

Are you saying we should not put this line at all in the code

Reopen_Report.RefreshReport();
That is what I am saying.

You can use it when you first open the report or save the report without data and it will automatically refresh when opened.

mlmcc
Hi mlmcc,

i have removed the refresh from else part of code. It is only there in postback now.
Looks like toolbar issue while export,print,next is happening quickly now without reloading again.

But the first loading is still slow. When i run the report in crystal software it takes few seconds,but in webpage it takes more than 3 mins.

Can you please explain the 2nd line of yours in details. How to save it and load it? Because it has date as parameter and if parameter changes it has to reload fresh again.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes i am running the report against the same database. Its oracle 10 and odbc of which is installed on the web server.
How do i set as no printer. Is it the bottom option in page setup. I am using crystal xiv
Yes.

mlmcc
Thank You So much.