CrystalReport Load report failed

前端 未结 7 1602
孤街浪徒
孤街浪徒 2020-12-16 17:28

I have a windows application project (C# and .NET 2.0) that used Crystal Report 2008. But I get error sometimes (it seems accidentally) in loading report. That error is:

相关标签:
7条回答
  • 2020-12-16 18:08

    I have verified John Dyer's solution, above, does not work in all cases.

    I have also verified that reinstalling Crystal Runtime did no good for this particular error.

    For my app this was only happening on Citrix installs of a stand-alone .exe, with embedded reports. Before using the Crystal Report Viewer, I need to make sure that I've cleared out any report previously loaded in the viewer, as per John's instructions. So, I'll wrote something (in VB) which looks like

    Public Function ShowRpt(...) As Boolean
        ....
        CleanOutViewer()
        ....
    End Function
    

    where CleanOutViewer is:

    Private Sub CleanOutViewer()
        If Not Me.CrystalReportViewer1.ReportSource() Is Nothing Then
            CType(Me.CrystalReportViewer1.ReportSource(), CrystalDecisions.CrystalReports.Engine.ReportDocument).Close()
            CType(Me.CrystalReportViewer1.ReportSource(), CrystalDecisions.CrystalReports.Engine.ReportDocument).Dispose()
            Me.CrystalReportViewer1.ReportSource() = Nothing
            GC.Collect()
        End If
    End Sub
    

    The calls after .Close() also had no effect (and were added as an alternate attempt to try to force the Crystal to release resources).

    0 讨论(0)
提交回复
热议问题