Crystal Report Taking time
Printed From: Crystal Reports Book — Forum Name: Talk with the Author
Posted By: Srinivasan — 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.
Posted By: hilfy — 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
Posted By: Srinivasan — 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.
Posted By: hilfy — 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
Posted By: Srinivasan — 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?
Posted By: hilfy — 1 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
|