How to speed up reports loading time? RRS feed

  • Question

  • I have few classes in my Visual Studio 2008 solution in which I fetch records from the database and store in a DataSet. This DataSet acts as a DataSource to Crystal Report Viewer on my Windows Forms. Programatically, I create a .XSD file to connect my Crystal Reports with the DataSet. The code looks like this:


       string Query = "Select A.CategoryName As Category, B.BillNo, date_format(B.BillDate, '%Y/%m/%d') As Date, round(sum(B.Total),2) As Value,C.TradeName, C.OwnerAddress, C.OwnerTinNo From CategoryMaster A, BillITems B, OwnerDetails C where A.CategoryID = B.CategoryID AND B.BillDate Between '" + dtpFrom.Value.ToString("yyyy/MM/dd") + "' AND '" + dtpTo.Value.ToString("yyyy/MM/dd") + "' group by B.CategoryID,B.BillNo Order By B.BillDate,B.BillNo";
    .dsCategoryReport = MyDataClass.ReturnDataSet(Query, "CategoryWiseTransaction");
    dgvCategoryReport.DataSource = MyDataClass .dsCategoryReport.Tables[0]; MyDataClass .dsCategoryReport.WriteXml("CategoryWiseReport.xsd",XmlWriteMode.IgnoreSchema);


    When I run the final application, reports load very slow on Crystal Report Viewer. I tested the queries directly on SQL Query Browser to check whether queries are fast or not and found that queries display results lightening fast. But when the report is connected to this .XSD file, they load very slow.

    I am sure I am not using correct way. Please let me know how to load reports fast.

    • Edited by OldEnthusiast Wednesday, July 13, 2011 10:08 AM corrections
    Wednesday, July 13, 2011 10:07 AM


  • Hi Old,

    Couple of things to note, if you are using more than one table in your XML Cr is very slow to process them, we try to link every table and every field so that may be the cause. Use one table if you can when you generate the XML.

    Second, on the first load of any report CR Assemblies are then loaded by the app. The work around is to load a dummy report on the App load or main load and then close and dispose the temp report. CR will stay in memory now so the next load with be right away. Only possible slow down would be due to reports with saved data.

    Also, be sure to check off all of the Verify options in the Report Options menu, if not CR will try to connect to the data source and verify and typically this is a 1 minute time out.


    Don Williams
    • Marked as answer by OldEnthusiast Saturday, July 16, 2011 12:17 PM
    Wednesday, July 13, 2011 9:19 PM