Crystal Reports performance problem

Jan 10 2006 10:45 AM

Hello,

I am in the process of writing a program which will create a dataset from an xml file and create a Crystal based on this dataset. I have completed this task, but for some reason, setting the report datasource is incredibly time consuming (9 seconds to load a report).

For experimenting purposes, I left out the following statement --> 

this.reportDocument1.SetDataSource(dtsData);

, and then I ran the application again. Now it took less than 2 seconds. Of course, leaving the statement out is not an option, because I would have no updated data in my report. But I do need it to run faster. 

So does anyone have any idea what could cause it to run so slowly? I would really appreciate any help. Even just a suggestion.

The code is below, and I have highlighted the statement that takes 7 seconds to execute.

Cheers,
Fred




private
void PreviewReport()

{

try

{

this.reportDocument1.Load(@strReportPath);

DataSet dtsData = new DataSet();

dtsData.ReadXml(strXMLPath);

System.Data.DataTableCollection dtCollection = dtsData.Tables;

System.Collections.IEnumerator iEnumTables = dtCollection.GetEnumerator();

iEnumTables.MoveNext();

System.Data.DataTable dt = (System.Data.DataTable)iEnumTables.Current;

this.utvalgsKriterier = (string)dt.Rows[0]["param"];

this.strReportTitle = (string)dt.Rows[0]["tittel"];

this.reportDocument1.SetDataSource(dtsData);

this
.cRVOrder.ReportSource = this.reportDocument1;

this.reportDocument1.SummaryInfo.ReportTitle = this.strReportTitle;

this.reportDocument1.SummaryInfo.ReportComments = this.utvalgsKriterier;

this.reportDocument1.SummaryInfo.ReportAuthor = this.strBrukerNavn;

}//end try

catch(Exception e)

{

MessageBox.Show("The following error was discovered: " + e.Message + ". It was occured in " + e.StackTrace + "//", "Report Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error);

}//end catch

}//PreviewReport


Answers (2)