Quantcast
Viewing all articles
Browse latest Browse all 3636

How to recover from hanging on ExportToStream

I'm using SAP Crystal Reports, developer version for Microsoft Visual Studio v13.0.2000.0.

My code is as follows:

foreach (var report in reportList)

{

   var document = new ReportDocument();

   document.Load(fullPath);

   document.SetParameterValue(fieldName, value);

   var reportStream = (MemoryStream)document.ExportToStream(ExportFormatType.PortableDocFormat);

   document.Close();

}

 

It works perfectly. If something goes wrong on my database, I will get the "Failed to retrieve data from the database" error which is fine and expected. However, if I catch this error, recover my database problem and try again (next run of the foreach loop), my application will hang on the call to ExportToStream.

 

I tried the same scenario witch Crystal Reports XI application. At first If I try to preview my report it will give me the "Failed to retrieve data from the database" error. Then if I recover my database error and retry the preview, I will get a "Accessing Database" message in the left corner and it won't be fixed until I reopen the Crystal Report application (reopening the report file does not fix the problem).

 

Any help is much appreciated.


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>