cancel
Showing results for 
Search instead for 
Did you mean: 

ReportDocument.SetDataSource(DataTable dataTable) OutOfMemoryException

Former Member
0 Kudos
439

When a customer attempts to display a certain report with a calendar year of data, they get the OutOfMemoryException. Apparently they can successfully display any other report before or after. This is .NET 2.0, Crystal Reports 2008 on a desktop client querying a database server.

Exception: Exception of type 'System.OutOfMemoryException' was thrown. (Type: System.OutOfMemoryException; Source: System.Data)

STACK TRACE (Top Level):

at System.Data.Common.Int32Storage.SetCapacity(Int32 capacity)

at System.Data.RecordManager.set_RecordCapacity(Int32 value)

at System.Data.RecordManager.GrowRecordCapacity()

at System.Data.RecordManager.NewRecordBase()

at System.Data.RecordManager.CopyRecord(DataTable src, Int32 record, Int32 copy)

at System.Data.DataTable.CopyRow(DataTable table, DataRow row)

at System.Data.DataTable.Copy()

at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)

Can any configuration be set to provide more memory? Is there a way to tell in advance if a dataset or datatable is too large?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

Are you connecting to the database directly or using a Data Set?

Crystal Reports is not a Database Archiving tool.

Do they really need that much data? If it is doing a lot of summing or counting then create a Stored Procedure and do all of the filtering Server side. DB Servers are much more efficient at collecting data than CR will ever be.

No option to increase memory, it's simply a limit of the OS and 32 bit addressing

Don

Former Member
0 Kudos

Report uses a DataSet DataTable (see stack trace).

'Found the SQL query included a field unused in the Crystal Report. Removing this field reduced the records from 5408 to 137 on development machine. 'Likely will resolve issue for customer. Exception did not occur in this scenario with Crystal 9, just after upgrade to CR2008.

0 Kudos

Doh... Sorry should have noticed that you are using a DS

Yes, in CR 9 it was lighter, after CR 10 they rewrote/updated the DB drivers as well as other new features so CR consumes more memory space.

DS's are good for about 5K rows, depends on the amount of data in the row of course, anything more and you will always get an out of memory error. Due to limitations in the way Windows handles DS's, now one can access the DS directly so when you use it CR needs to copy the DS it our memory space thus doubling the amount of memory required.

If you are going to allow them to use large data sets then either create another report that hits the DB directly or convert the existing report using RAS using the Replace_Connection method ( search here for sample code ) and set location to the DB using OLE dB Provider.

Thanks

Don

Answers (0)