473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 2578
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard Hallgren | last post by:
Hi, I have a project that uses Crystal Reports (VS .Net included) and the System.Data namespace. I've managed to deploy the project and to get Crystal Report working on my clients XP based...
2
by: Mythran | last post by:
In .Net, how can I go about and set a Crystal Reports namespace? Right now they use the Root Namespace (VB) from the project. How can I extend the namespace for a single report (which will be set...
0
by: stephan | last post by:
I know that this has been beaten to death but I can't seem to resolve my issues (I have 2 of them). I have created a class that exposes a public method which returns a datatable as a datasource...
1
by: Islam Elkhayat | last post by:
I have problems with crystal Report... i use SQL query to fill dataGrid, i use checkboxs to select the column to return and build my query.. I want to create a report with the data of the datagrid...
3
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to...
7
by: John | last post by:
I am using Crystal Reports in my application I made using Visual Studio.NET. I installed my application on the client machine, with all the DLLs required(added the merge modules), the engine and...
2
by: Diogo Alves - Software Developer | last post by:
Hi, I'm desesperate, for long 4 days that I am trying to deploy an application with crystal reports, and it fails... I checked the documentation and it says the merge modules necessary to...
1
by: Tim_Mac | last post by:
hi, i am encountering a sporadic exception using crystal reports that is causing me grief, I can't 'handle' it... my code is loading a typed report, and loading a DataSet to it. unfortunately...
2
by: matt | last post by:
hello, i have an .RPT file that i am using to load a report via the ASP.NET CrystalReportViewer control. i dont include my .RPTs as embedded resources...instead i load the absolute path of the...
1
by: appandairajc | last post by:
Hi Friends, I have a problem in Crystal Reports. I have a web application and it was published in machine. I am running that application through a virtual path. All the pages are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.