crystal report taking long time for preview
-
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.
-
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.
You're selecting everything from the customers table to add to the report. Is this where the bottleneck is? Do you need to select all of this data?
-
You're selecting everything from the customers table to add to the report. Is this where the bottleneck is? Do you need to select all of this data?
-
thnx for Ur replay. I am taking one record only using where condition,but that time also this report taking more time for first preview,next preview its taking less time compare to first preview.
If your database connection has not been pooled, then the first preview will take a lot longer than the second time where it's pulled from the pool.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
thnx for Ur replay. I am taking one record only using where condition,but that time also this report taking more time for first preview,next preview its taking less time compare to first preview.
Is the column you are referencing in your where clause defined by an index ? Use the "show execution plan" option in query analyzer to make sure the query is not doing table scans. Optimize the query first, then the report should work fine.