Crystal Reports exception

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OzSoft

    #1

    Crystal Reports exception

    I am receiving the following exception randomly when printing crystal reports
    via a print server application. The server will successfully print a random
    number of an identical reports (report.rpt) and then for some reason, the
    following exception is logged.

    System.InvalidO perationExcepti on: Stack empty.
    at System.Collecti ons.Stack.Pop()
    at SCRStartup.Leav e()
    at CrystalDecision s.CrystalReport s.Engine.Report Objects..ctor(S CRPrintJob
    printJob, Int32 sectionCode)
    at CrystalDecision s.CrystalReport s.Engine.Report Objects.GetEnum erator()
    clsReports.LogI nReport()

    The code for LogInReport is as follows

    Dim ret As Boolean = False
    Dim repDoc As New ReportDocument
    Dim subRepDoc As New ReportDocument
    Dim crSections As Sections
    Dim crSection As Section
    Dim crReportObjects As ReportObjects
    Dim crReportObject As ReportObject
    Dim crSubReportObje ct As SubreportObject
    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As Table
    Dim crConnInfo As New ConnectionInfo
    Dim crLogOnInfo As New TableLogOnInfo
    Try
    repDoc.Load(mst rFile, OpenReportMetho d.OpenReportByD efault)

    With crConnInfo
    .ServerName = mstrServer
    .DatabaseName = mstrDatabase
    .UserID = mstrUserName
    .Password = mstrPassWord
    End With

    'we iterate through the report database tables and log the user in
    crDatabase = repDoc.Database
    crTables = crDatabase.Tabl es
    For Each crTable In crTables
    crLogOnInfo = crTable.LogOnIn fo
    crLogOnInfo.Con nectionInfo = crConnInfo
    crTable.ApplyLo gOnInfo(crLogOn Info)
    Next

    crSections = repDoc.ReportDe finition.Sectio ns
    For Each crSection In crSections
    crReportObjects = crSection.Repor tObjects
    For Each crReportObject In crReportObjects
    If crReportObject. Kind =
    ReportObjectKin d.SubreportObje ct Then
    crSubReportObje ct = CType(crReportO bject,
    SubreportObject )
    subRepDoc =
    crSubReportObje ct.OpenSubrepor t(crSubReportOb ject.SubreportN ame)
    crDatabase = subRepDoc.Datab ase
    crTables = crDatabase.Tabl es
    For Each crTable In crTables
    crLogOnInfo = crTable.LogOnIn fo
    crTable.LogOnIn fo.ConnectionIn fo = crConnInfo
    crTable.ApplyLo gOnInfo(crTable .LogOnInfo)
    Next
    End If
    Next
    Next
    ret = True
    Catch ex As Exception
    EventLog.WriteE ntry(AppName, ex.ToString, EventLogEntryTy pe.Error)
    End Try
    Return ret

    Any ideas?

    TIA


  • OzSoft

    #2
    RE: Crystal Reports exception

    This is an issue with Crystal running on dual processor machines. To resolve
    the issue you have to bring up Task Manager, select your application, right
    click and set affinity. Set your application up to run only on one CPU.

    "OzSoft" wrote:
    [color=blue]
    > I am receiving the following exception randomly when printing crystal reports
    > via a print server application. The server will successfully print a random
    > number of an identical reports (report.rpt) and then for some reason, the
    > following exception is logged.
    >
    > System.InvalidO perationExcepti on: Stack empty.
    > at System.Collecti ons.Stack.Pop()
    > at SCRStartup.Leav e()
    > at CrystalDecision s.CrystalReport s.Engine.Report Objects..ctor(S CRPrintJob
    > printJob, Int32 sectionCode)
    > at CrystalDecision s.CrystalReport s.Engine.Report Objects.GetEnum erator()
    > clsReports.LogI nReport()
    >
    > The code for LogInReport is as follows
    >
    > Dim ret As Boolean = False
    > Dim repDoc As New ReportDocument
    > Dim subRepDoc As New ReportDocument
    > Dim crSections As Sections
    > Dim crSection As Section
    > Dim crReportObjects As ReportObjects
    > Dim crReportObject As ReportObject
    > Dim crSubReportObje ct As SubreportObject
    > Dim crDatabase As Database
    > Dim crTables As Tables
    > Dim crTable As Table
    > Dim crConnInfo As New ConnectionInfo
    > Dim crLogOnInfo As New TableLogOnInfo
    > Try
    > repDoc.Load(mst rFile, OpenReportMetho d.OpenReportByD efault)
    >
    > With crConnInfo
    > .ServerName = mstrServer
    > .DatabaseName = mstrDatabase
    > .UserID = mstrUserName
    > .Password = mstrPassWord
    > End With
    >
    > 'we iterate through the report database tables and log the user in
    > crDatabase = repDoc.Database
    > crTables = crDatabase.Tabl es
    > For Each crTable In crTables
    > crLogOnInfo = crTable.LogOnIn fo
    > crLogOnInfo.Con nectionInfo = crConnInfo
    > crTable.ApplyLo gOnInfo(crLogOn Info)
    > Next
    >
    > crSections = repDoc.ReportDe finition.Sectio ns
    > For Each crSection In crSections
    > crReportObjects = crSection.Repor tObjects
    > For Each crReportObject In crReportObjects
    > If crReportObject. Kind =
    > ReportObjectKin d.SubreportObje ct Then
    > crSubReportObje ct = CType(crReportO bject,
    > SubreportObject )
    > subRepDoc =
    > crSubReportObje ct.OpenSubrepor t(crSubReportOb ject.SubreportN ame)
    > crDatabase = subRepDoc.Datab ase
    > crTables = crDatabase.Tabl es
    > For Each crTable In crTables
    > crLogOnInfo = crTable.LogOnIn fo
    > crTable.LogOnIn fo.ConnectionIn fo = crConnInfo
    > crTable.ApplyLo gOnInfo(crTable .LogOnInfo)
    > Next
    > End If
    > Next
    > Next
    > ret = True
    > Catch ex As Exception
    > EventLog.WriteE ntry(AppName, ex.ToString, EventLogEntryTy pe.Error)
    > End Try
    > Return ret
    >
    > Any ideas?
    >
    > TIA
    >
    >[/color]

    Comment

    • Kevin Yu [MSFT]

      #3
      RE: Crystal Reports exception

      Hi OzSoft,

      First of all, I would like to confirm my understanding of your issue. From
      your description, I understand that you're having a CR exception randomly.
      If there is any misunderstandin g, please feel free to let me know.

      As far as I can see, this is a Crystal Report issue. I'm sorry but this
      product is currently not supported by Microsoft. Besides posting here, you
      can also check the Crystal Report technical support website for more
      information. Please check the following KB article which will give you the
      link for them.



      Kevin Yu
      =======
      "This posting is provided "AS IS" with no warranties, and confers no
      rights."

      Comment

      Working...