Print Page | Close Window

Crystal Report Taking time

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Talk with the Author
Forum Discription: Ask Brian questions about his books and give him your comments. Like the book? Hate the book? Have suggestions? Let me know!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6450
Printed Date: 24 Apr 2024 at 1:52pm


Topic: Crystal Report Taking time
Posted By: Srinivasan
Subject: Crystal Report Taking time
Date Posted: 25 May 2009 at 12:32am
Hello everyone ,

I have an issue i.e, I am using crystal report(version 11 release 2) in my windows applications developed in vb.net (2005)and sql server(2005) as backend . In one of the forms i placed one reportviewer control,

crystal report taking long time for preview & print(nearly 2 minute) .
please any one help me to getout of this

Dim rpt As New CrystalReport1() 'The report you created.
        Dim myConnection As SqlConnection
        Dim MyCommand As New SqlCommand()
        Dim myDA As New SqlDataAdapter()
        Dim myDS As New Dataset1() 'The DataSet you created.

        Try

            myConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;" & _
                                             "Initial Catalog=northwind;")
            MyCommand.Connection = myConnection
            MyCommand.CommandText = "SELECT * FROM Customers"
            MyCommand.CommandType = CommandType.Text
            myDA.SelectCommand = MyCommand

            myDA.Fill(myDS, "Customers")
            rpt.SetDataSource(myDS)
            CrystalReportViewer1.ReportSource = rpt

        Catch Excep As Exception
            MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

Advance thnx.

-------------
srini



Replies:
Posted By: hilfy
Date Posted: 27 May 2009 at 9:49am
A lot depends on the structure of your report, the number of records you're reading, and the types of sorts or filters that are in your report.
 
Since the report is reading a dataset, if the dataset is not filtered or sorted, all of that will happen inside Crystal after it has read all of the records.  If you have a lot of records, this will take some time.  One of the things that I highly recommend is that you filter the data that is read into the dataset when the query is run instead of relying on Crystal to do that for you.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Srinivasan
Date Posted: 28 May 2009 at 3:45am
Thank u For your Replay .
Sir
I modified my code like this
          
             MyCommand.CommandText = "SELECT * FROM Customers where cid=10 order by cid"

But this time also same. Second Preview is coming Fast(nearly 10 seconds its took.) but My first preview taks nearly 2 minutes.
Please tell any one way to solve this Problem.
            


-------------
srini


Posted By: hilfy
Date Posted: 28 May 2009 at 6:09am

The first time you view a report from .NET, the Crystal assemblies need to load into memory.  How long this takes is a function of the amount of RAM that is available on the computer where your code is running and the speed of the processor.  If there's not enough RAM, then stuff has to be swapped to the virtual memory on disk and this takes longer.

My current laptop is brand new and has a dual-core processor and lots of RAM, but my old laptop (three years old) had 2GB of RAM and a 1 GHz processor.  It took about 30 seconds to load a report the first time.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Srinivasan
Date Posted: 30 May 2009 at 6:29am
thank you sir.
Now i want to solve that problem for that give any solution.i can't tell to my each client to change their system configuration ,I want to increase the speed using code,any dll want to add or what want do?

-------------
srini


Posted By: hilfy
Date Posted: 01 Jun 2009 at 1:01pm
There is not much that can be done - the assemblies have to load, that takes memory.  There is no alternate way around it.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window