Click here to Skip to main content
11,705,617 members (48,738 online)
Rate this: bad
good
Please Sign up or sign in to vote.
My Crystal Reports take forever to load in my application - at least 2 minutes: This is my code. What do I do wrong?
private void button1p_Click(object sender, RoutedEventArgs e)
        {
            Windows.CrystalReportViewerWindow wnd = new ePAM.Windows.CrystalReportViewerWindow();
 
            // Change 'OperationalUnitTableAdapter' to appropriate adapter.
            ePAM.Reports.StrategyDataSetTableAdapters.OperationalUnitTableAdapter adapter = new ePAM.Reports.StrategyDataSetTableAdapters.OperationalUnitTableAdapter();
            adapter.Connection.ConnectionString = BusinessLayer.BusinessLayer.GetConnectionString();
            adapter.Fill(dataSet.OperationalUnit);
 
            // Change 'Operational_Units' to appropriate report.
            Reports.Print.Operational_Units objReport = new Reports.Print.Operational_Units();
 
            // Change 'dataSet.OperationalUnit' to 'dataSet.***'.
            objReport.SetDataSource(dataSet);
 
            wnd.MyReportViewer.ReportSource = objReport;
            wnd.MyReportViewer.RefreshReport();
            wnd.ShowDialog();
 
        }

Thanks in Advance

Suzie
Posted 12-Apr-10 22:57pm
Suziem414
Edited 12-Apr-10 23:45pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Basically you just create a empty report and open it (no need to set data source or anything you just initiate it)
This will load the crystal reports framework into memory and should cut down loading time drastically.
  Permalink  
Comments
alrajhi20 at 11-May-14 0:15am
   
Would you please send the proper code for initiating it?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check if the second time you open a crystal report is still loading as slow.

Crystal reports is very very slow on the loading for the first time but should be fast when loading the report (or a different one) for a second time (without closing the application)

If it's the case that it is only for the first time then I suggest that you load a dummy report (in the background on a different thread) when loading your application, without showing the report of course.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Have you run this under the debugger to see exactly what part of it is slow? Which line is taking the most time?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

basically when you run first time it always slow because opening and loading database is slow. from second time onwards it will become faster. to check create a empty crystal report and run it. you will see it is faster than the database connected crystal report.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

objReport.SetDataSource(dataSet);
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

CrystalReportViewer1.Refresh()

in this line it will take more time....
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 10

SOLVED(meanwhile). My solution was passing the data through a DataTable. The waiting time changed from 10 seconds to 1 second. My story:
I am currently working on a web project with vs.net 2012 and Crystal Report v13. During the report design, the report Oldb connection was fine with the time, but when I load the report in asp.net, reporting slow loading 10 seconds. I was using the SetDatabaseLogon function to pass the username and password of connection.
After reading out there, some people thought the problem was in the method of connecting to the database of crystal report, and they recommended not to connect the report to the database, it is better to pass to the report, a dataSet or dataTable because the connection to the database is much faster through asp.net application.
I did so, I load the data into a DataTable and assign it to the report, in its setDataSource property and burden of reporting was 1-2 seconds.
This is my function:

protected void Page_Load(object sender, EventArgs e)
{
    spTituloVisor.InnerText = "Consulta de Anticipo";
 
    //I get the querystring the value of the variable that is encrypted
    string val = Request.QueryString["ValD"];
    int id = Convert.ToInt32(CryptoAES.descifrarTextoAES(val));
 
    ReportDocument Rpt = new ReportDocument();
    Rpt.Load(Server.MapPath("~/Paginas/Anticipo/Reportes/Rpt_Anticipo.rpt"));
    ////Rpt.SetParameterValue("@ID_ANTICIPO", id);
    ////Rpt.SetDatabaseLogon("uSIGF", "uSIGF.321");
    Rpt.SetDataSource(Core_PBL.Rpt_Consulta_Anticipo(id)); //return Datatable to CR
    CrystalReportViewer1.ReportSource = Rpt;
}
  Permalink  
v3

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

  Print Answers RSS
0 OriginalGriff 229
1 Sergey Alexandrovich Kryukov 100
2 Inimicos 60
3 ProgramFOX 50
4 Richard MacCutchan 45
0 OriginalGriff 9,053
1 Sergey Alexandrovich Kryukov 8,347
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,626


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 16 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100