Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: paging problems in CR- winforms Post Reply Post New Topic
Author Message
tom789
Newbie
Newbie


Joined: 30 Mar 2010
Online Status: Offline
Posts: 3
Quote tom789 Replybullet Topic: paging problems in CR- winforms
     Posted: 30 Mar 2010 at 5:03am

Hi!
I work with C#.NET in a product that generates reports using the .NET CrystalReportViewer in Visual Studio 2008.
When a multi-page report is generated, I click the "next page button", and I'm taken to the next page in one second or two. When i use "go to" box, the viewer is too slow, more than 30 seconds and even minutes! If I click the "last page" button, it takes me to the last page in 10 minutes or more!
The reports often have more than 600 pages.

I did a debug from the code and there is no problem with the database, query, and so on.All the process take only few seconds . I think the problem is in the CrystalReportViewer.

Has anyone encountered this issue before? Any input would be appreciated.

The code:

public void print(string tipocomp, string nrolote)
        {           
          
            DataTable rows = someClass.searchMovFac(tipocomp, nrolote);
           
            DsFactura _facturaDS = new DsFactura();//DataSet DsFactura

            _facturaDS.movimientos.Merge(rows);

            frmFacturas vistaFormAB = new frmFacturas();//winform

           
            switch (tipocomp)
            {
                case "A":
                    FacturasA facturaA = new FacturasA();//Report

                    facturaA.SetDataSource(_facturaDS);
                   
                   //vistaReport is a CrystalReportViewer
                    vistaFormAB.vistaReport.ReportSource = facturaA;

                    break;
                case "B":
                    FacturasB facturaB = new FacturasB();
                    facturaB.SetDataSource(_facturaDS);
                    vistaFormAB.vistaReport.ReportSource = facturaB;
                    break;
            }
           
            vistaFormAB.Show();
                
        }
    }

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Apr 2010 at 5:03am
The viewer actually renders each page as you get to it.  That is why it is fairly quick to go to the next page.  However, when you specify a page number or go to the end, it has to render ALL of the pages in between where you are and where you're going in order to know what to put on the page you've requested.  For a 600 page report, this is going to take some time.
 
Also, do you have any subreports in the report?  That will significantly slow down the processing because Crystal will have to run the subreport every time it's encountered between the beginning what has already been rendered.  Each instance of a subreport runs its query against the database.  For example, if you have a subreport in a group footer, every time that group footer has to be rendered between where you are and where you're going, Crystal will query the database to get the data for the subreport before it renders the page.
 
-Dell
IP IP Logged
tom789
Newbie
Newbie


Joined: 30 Mar 2010
Online Status: Offline
Posts: 3
Quote tom789 Replybullet Posted: 05 Apr 2010 at 5:04am
Yes, I'm working with subreports.
Check my code please, first at all i set in the DataTable the result of the query. So why does Crystal Report run its query against? I don't understand. Is there a way to improve it?
Any help?
Thanks
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 05 Apr 2010 at 5:49am

If you're working with DataTables, Crystal won't re-query the data from the database, but it will re-query the DataTable.  When you work with in-memory data sets like this, there is no database server to do the filtering, so Crystal has to read through all of the records in the DataTable to get the ones that meet the specific criteria for the sub-report.  This may be a situation where it's actually faster to connect the report directly to the database instead of using in-memory data.

-Dell
IP IP Logged
tom789
Newbie
Newbie


Joined: 30 Mar 2010
Online Status: Offline
Posts: 3
Quote tom789 Replybullet Posted: 14 Apr 2010 at 4:48am
thanks hilfy!!! :)
 
but...how can i connect ther report directly to the database?? Can you give me some links to tutorials? I haven't done that before.
 
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum