on 11-13-2014 4:54 PM
Hi Community,
I have a question about the two Close methods of the ras sdk.
I am using the following code to Close a printed or exported Report:
reportClientDocument.Close();
reportClientDocument = null;
report.Close();
report.Dispose();
the Report.close gets an error (an external component has raised a condition).
I am not sure if I Need to use all of the Statements. It seems that the reportclientdocument.close also Closes the Report and thats why the Report.close or the Report.dispose() gets error.
Does anybody know if the reportClientDocument.close implements the Report.close? I thougth that I have to use the Report.dispose() to release the unused objects.
Thanks for your help.
Regards
joerg
Hi Jorg
it just depends on how you define your objects. If they are dfined as reportClientDocument, then use
reportClientDocument.Close();
reportClientDocument = null;
If they are defined as report, use
report.Close();
report.Dispose();
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ludek,
thanks to you and Don for the answer.
I use the following code to open the Report:
_report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
_report.Load(_reportFilename);
_reportClientDocument = _report.ReportClientDocument;
And now I use this code to Close and destroy the objects. With this code I get no exception.
_reportClientDocument = null;
_report.Close();
_report.Dispose();
Thanks to you both.
regards
joerg
Hi Joerg,
Since you are using the ReportDocument to open the report and then casting that report object to the ReportClientDocument they are virtually the same object.
So simply closing the ReportDocument is all that is required. The RAS Engine will close and dispose its reference to the report object.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.