473,385 Members | 1,606 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,385 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 2575
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.