Skip to Content
0
Former Member
Oct 28, 2013 at 02:19 PM

Crystal report taking forever to load a simple report

91 Views

Hi :

I have upgraded my reports from VS2008 to VS2012. When i try to run the report using vb.net. The report is taking forever to load a simple report.

    Dim cr As New crptInvSummary()        Dim crtableLogoninfos As New TableLogOnInfos        Dim crtableLogoninfo As New TableLogOnInfo        Dim crConnectionInfo As New ConnectionInfo        Dim crTables As Tables        Dim crTable As Table        'Get database connection info        With crConnectionInfo            .ServerName = My.Settings.kressConnectionString.Split(";")(0).Split("=")(1)            .DatabaseName = My.Settings.kressConnectionString.Split(";")(1).Split("=")(1)            .UserID = My.Settings.kressConnectionString.Split(";")(3).Split("=")(1)            .Password = My.Settings.kressConnectionString.Split(";")(4).Split("=")(1)        End With        'Set database connection for all tables in report        crTables = cr.Database.Tables        For Each crTable In crTables            crtableLogoninfo = crTable.LogOnInfo            crtableLogoninfo.ConnectionInfo = crConnectionInfo            crTable.ApplyLogOnInfo(crtableLogoninfo)        Next        ' Loop through each section and find report objects          Dim crReportobjects As ReportObjects, crSubReportobject As SubreportObject, subReportDocument As ReportDocument        Dim crDatabase As Database        Dim crSections As Sections = cr.ReportDefinition.Sections        For Each crSection As Section In crSections            crReportobjects = crSection.ReportObjects            For Each crReportobject As ReportObject In crReportobjects                If crReportobject.Kind = ReportObjectKind.SubreportObject Then                    ' If a subreport is found cast as subreportobject                                            crSubReportobject = CType(crReportobject, SubreportObject)                    ' Open the sub report                                            subReportDocument = crSubReportobject.OpenSubreport(crSubReportobject.SubreportName)                    crDatabase = subReportDocument.Database                    crTables = crDatabase.Tables                    ' Loop through each table in the sub report and set the connection info                                            For Each crTable In crTables                        crtableLogoninfo = crTable.LogOnInfo                        crtableLogoninfo.ConnectionInfo = crConnectionInfo                        crTable.ApplyLogOnInfo(crtableLogoninfo)                    Next                End If            Next        Next        Dim nstartdate As Date, nenddate As Date        nstartdate = dtpStart.Value        nenddate = dtpEnd.Value         nstartdate = CDate(nstartdate)        nenddate = CDate(nenddate)        'Set report parameters        cr.SetParameterValue("Start_Date", nstartdate)        cr.SetParameterValue("End_Date", nenddate)        If (optMonthly.Checked) Then            cr.SetParameterValue("Billing_Cycle", "Monthly")        Else            cr.SetParameterValue("Billing_Cycle", "Weekly")        End If        'Show report        With CrystalReportViewer1            .ReportSource = cr            .Zoom(100)            .Visible = True            .Refresh()        End With

Is there something that i need to change for it to work properly.

The same report normally takes 5sec to load in VS2008.