469,924 Members | 1,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,924 developers. It's quick & easy.

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.InvalidOperationException: Stack empty.
at System.Collections.Stack.Pop()
at SCRStartup.Leave()
at CrystalDecisions.CrystalReports.Engine.ReportObjec ts..ctor(SCRPrintJob
printJob, Int32 sectionCode)
at CrystalDecisions.CrystalReports.Engine.ReportObjec ts.GetEnumerator()
clsReports.LogInReport()

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 crSubReportObject 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(mstrFile, OpenReportMethod.OpenReportByDefault)

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.Tables
For Each crTable In crTables
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next

crSections = repDoc.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind =
ReportObjectKind.SubreportObject Then
crSubReportObject = CType(crReportObject,
SubreportObject)
subRepDoc =
crSubReportObject.OpenSubreport(crSubReportObject. SubreportName)
crDatabase = subRepDoc.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crLogOnInfo = crTable.LogOnInfo
crTable.LogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
End If
Next
Next
ret = True
Catch ex As Exception
EventLog.WriteEntry(AppName, ex.ToString, EventLogEntryType.Error)
End Try
Return ret

Any ideas?

TIA
Jul 21 '05 #1
2 2311
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:
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.InvalidOperationException: Stack empty.
at System.Collections.Stack.Pop()
at SCRStartup.Leave()
at CrystalDecisions.CrystalReports.Engine.ReportObjec ts..ctor(SCRPrintJob
printJob, Int32 sectionCode)
at CrystalDecisions.CrystalReports.Engine.ReportObjec ts.GetEnumerator()
clsReports.LogInReport()

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 crSubReportObject 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(mstrFile, OpenReportMethod.OpenReportByDefault)

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.Tables
For Each crTable In crTables
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next

crSections = repDoc.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind =
ReportObjectKind.SubreportObject Then
crSubReportObject = CType(crReportObject,
SubreportObject)
subRepDoc =
crSubReportObject.OpenSubreport(crSubReportObject. SubreportName)
crDatabase = subRepDoc.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crLogOnInfo = crTable.LogOnInfo
crTable.LogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
End If
Next
Next
ret = True
Catch ex As Exception
EventLog.WriteEntry(AppName, ex.ToString, EventLogEntryType.Error)
End Try
Return ret

Any ideas?

TIA

Jul 21 '05 #2
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 misunderstanding, 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.

http://support.microsoft.com/default...b;en-us;317789

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

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Richard Hallgren | last post: by
2 posts views Thread by Mythran | last post: by
1 post views Thread by Islam Elkhayat | last post: by
3 posts views Thread by Milan Todorovic | last post: by
2 posts views Thread by Diogo Alves - Software Developer | last post: by
1 post views Thread by Tim_Mac | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.