[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Crystal report load slow on web page

Posted on 2011-05-10
11
Medium Priority
?
727 Views
Last Modified: 2012-05-11
Hi,

I have a web page that exports a crystal report to a PDF then displays that as a web page.

The code is below.  On my local machine the whole process runs in about 5 seconds.   However, the code line doc.Load(fileName);  (shown in the code) is taking about 30 seconds to run on the webserver.  Any ideas why this is?

The rpt file is in the same location as the app, I've installed the latest crystal installer, the report has no printer set and the line of code that attaches the dataset runs straight away, so it is only the part that loads the code.

Any help would be appreciated?

thanks


string identifier = Request.QueryString["identifier"];
            Guid testIdenifier = new Guid(identifier);

            DSTestResultsTableAdapters.tblTestHeaderTableAdapter testHead =
                new BSTResults.DSTestResultsTableAdapters.tblTestHeaderTableAdapter();
            int? testHeaderID = testHead.GetTestHeaderID(testIdenifier);
            if (testHeaderID > 0)
            {

                LogOutput("1");
                //Lets show the results then
                DSTestResultsTableAdapters.ProduceResults results
                    = new BSTResults.DSTestResultsTableAdapters.ProduceResults();
                  results.ProduceTestResults(testHeaderID);
                CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                string fileName = Properties.Settings.Default.ReportPath + Properties.Settings.Default.ReportFileName;
                DSTestResults.tblTestHeaderDataTable resultsData = new DSTestResults.tblTestHeaderDataTable();
                DSTestResultsTableAdapters.ShowTestResultsTableAdapter testRes
       = new BSTResults.DSTestResultsTableAdapters.ShowTestResultsTableAdapter();
                DSTestResults.ShowTestResultsDataTable testResData = testRes.GetData(testHeaderID);
                //load the rpt file to document
                doc.Load(fileName);

                doc.SetDataSource((DataTable)testResData);

                //set the export options to PDF

                ExportOptions exportOpts = doc.ExportOptions;

                exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

                exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;

                exportOpts.DestinationOptions = new DiskFileDestinationOptions();

                // Set the disk file options.
                DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
                string ExportPath = Properties.Settings.Default.ReportPath + "reportoutput\\" + identifier + ".pdf";
                ((DiskFileDestinationOptions)doc.ExportOptions.DestinationOptions).DiskFileName = ExportPath;
                //export the report to PDF rather than displaying the report in a viewer
                doc.Export();


                //force download dialog to download the PDF file at user end.
                //Set the appropriate ContentType.
                Response.ContentType = "Application/pdf";
                //Get the physical path to the file.
                string FilePath = ExportPath;
                //Write the file directly to the HTTP content output stream.

                Response.WriteFile(FilePath);
                Response.End();
            }
            else
            {
                Response.Write("Invalid Report");
            }

Open in new window

0
Comment
Question by:kinton
  • 6
  • 4
11 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 35733313
How are you loading on your machine?

How did you determine that that line is the bottleneck?

mlmcc
0
 
LVL 2

Author Comment

by:kinton
ID: 35733338
I'm using exaclty the same code on my machine, and just running it in debug mode.  That line of code runs instantly on my machine.  Again the report is sitting in the same folder as the app.

I'm determining the bottle neck as I added code to output a time stamp to a text file at every line of code, the time stamp above and below the line of code I mention always has a massive gap between it.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35733416
Is there a lot of activity on the network?

Is this running from your machine?

mlmcc
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:kinton
ID: 35733436
No, nothing else is running on the webserver, and there is no network connection at that point.

On my local machine this runs fine.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35734287
When you said there is no printer set did  you mean the NO PRINTER option is set?

mlmcc
0
 
LVL 2

Author Comment

by:kinton
ID: 35736289
Yes, the NO PRINTER option is set.
0
 
LVL 23

Accepted Solution

by:
Ido Millet earned 2000 total points
ID: 35736557
This is probably due to the following known issue that is fixed in FixPack 3.5:
----------------------
ADAPT01496545
Description:
Crystal Reports reports that have an SQL Expression take a long time to load if the original database is unreachable.  
This problem occurs because the ReportDocument.Load function tries to connect to the original SQL server even if it is not used in
the report.
New Behavior:
This problem is resolved.
----------------------
0
 
LVL 2

Author Comment

by:kinton
ID: 35739693
Hi,

I probably omitted some key info.  My dev version of crystal reports is 8.5..

However, I have installed the latest run time that comes packaged with VS2008.  It looks to me like this service pack is for the dev machine NOT the production machine.  Is that correct?
0
 
LVL 2

Assisted Solution

by:kinton
kinton earned 0 total points
ID: 35739955
IdoMillet - ok, your answer has given me the solution in a round about way, I started playing with the DB connection and found that connecting using ADO rather than ODBC was the answer!

I'm just testing, but will assign you the points shorlty assuming all is well.

Thanks for your help
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35740076
You need to install the runtimes for CR 8.5 on the server.  Crystal is converting the report to the new report format when you use the CR2008 runtimes.

mlmcc
0
 
LVL 2

Author Closing Comment

by:kinton
ID: 35767625
Part solution as it led me to the actual solution.  Without this I would not have found out the answer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month20 days, 3 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question