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
{
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
Fredrik RoaldsetPosted Jan 17, 2006, 5:48 AM
Thanks for your hint. I have figured out my problem, and I'm sorry to say that it is probably not related to yours. It was simply the xml creation that was flawed.
If I should stumble across something that might help, I will let you know.
Cheers,
Fred
MarkPosted Jan 16, 2006, 8:37 AM
We are using RecordSets in ASP to create our report, but the behaviour seems identical.
We have been looking into this for some months now, and still come up with nothing.
We have done a lot of testing around this, with various different sized recordsets. It seems that the time this line takes is exponential to the number of records in the recordset. The number of columns in the recordset seems to make little difference.
If you have any luck with this, I would be extremely pleased to hear your findings, as I say i have spent hundreds of hours trying to get this to an acceptable time.
I have been in touch with Crystal support, but they were of little use and simply pointed us to various hotfixes, service packs etc which were either already installed or of no consequence.
Good Luck
Mark