Crystal report prinjoblimit超出错误。尝试了diposal对象增加regisry没有用

时间:2017-01-04 06:28:57

标签: c# .net vb.net crystal-reports report

大家好我在水晶报道制作中遇到以下错误。我尝试过repordocument diposal。并且增加注册表值这两种情况都不起作用。附上的错误如下 enter image description here

enter image description here

[编辑]

请在我的代码下面查看我的确切代码方案

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   Try
        If rpt IsNot Nothing Then
            For Each t As Table In rpt.Database.Tables
                t.Dispose()
            Next
            rpt.Close()
            rpt.Dispose()
            rpt = Nothing
            ' GC.Collect()
        End If
    Catch ex As Exception

    End Try

    'Session("RPTManagmentName") = Session("RPTManagmentName") & "  -  " & Session("RPTBranchName")
    rpt = New ReportDocument
    Select Case Request.QueryString("RPT")
        Case 6
            Dim Report As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
            Report.Load(Server.MapPath("Reports/RPTBalances.rpt"))
            Report.SetDataSource(Session("BalancesReportDataSet").Tables(0))
            Report.SetParameterValue("ManagmentName", Session("RPTManagmentName"))
            Report.SetParameterValue("BranchName", Session("RPTBranchName"))
            Report.SetParameterValue("AccountName", Session("RPTAccountName"))
            Report.SetParameterValue("  FromDate", CStr(Session("RPTFromDate")))
            Report.SetParameterValue("ToDate", CStr(Session("RPTToDate")))

            Session("report") = Report
      End Select

    CRVShow.ReportSource = rpt
    CRVShow.DataBind()

End Sub


Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
        Try
        If rpt IsNot Nothing Then
            For Each t As Table In rpt.Database.Tables
                t.Dispose()
            Next
            rpt.Close()
            rpt.Dispose()
            rpt = Nothing
            ' GC.Collect()
        End If

        If CRVShow IsNot Nothing Then
            CRVShow.ReportSource = Nothing
            CRVShow.Dispose()
            CRVShow = Nothing
        End If
    Catch ex As Exception

    End Try

    Try
        rpt.Close()
        rpt.Dispose()
    Catch ex As Exception

    End Try
End Sub

1 个答案:

答案 0 :(得分:2)

我建议将close / dispose / gc.collect代码移到该卸载过程之外。换句话说:

  1. 加载报告
  2. 分配给Viewer Control
  3. 在Viewer Control中显示报告
  4. 关闭查看器控制和卸载(完全)
  5. 然后在任何查看器控制代码之外关闭/ dispose / gc.collect
  6. 我的猜测是在清理报告时,查看器控件未完全关闭。

    Crystal是一个内存密集型的过程,非常挑剔。