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 ?
.NET ProgrammingCrystal ReportsC#

Avatar of undefined
Last Comment
AnandSahoo

8/22/2022 - Mon
Mike McCracken

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

mlmcc
AnandSahoo

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

Reopen_Report.RefreshReport();
Mike McCracken

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
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
AnandSahoo

ASKER
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
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
AnandSahoo

ASKER
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
Mike McCracken

Yes.

mlmcc
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
AnandSahoo

ASKER
Thank You So much.