Help! Out of Memory Exception - using dataset as datasource for re

G

Guest

Hi,
I'm using a dataset close to 11 MB as the datasource for my crystal
reports.
I've 15 subreports in my report, of which all uses this dataset as the
datasource but some have Selection Formula applied to the report document to
filter the data. I get a Out of Memory exception while looping to set the
data source. Has anyone had this problem before, and how do I fix this. This
doesn't come all the time I run the report, it usually displays correctly 2
or 3 times, then I get this exception. Does it have something to do with
Garbage collection? The code and exception deatils are as given below.

Thanks,
Debi

This is the code
**********************************
sReportPath = Server.MapPath("Reports/Target_Merged.rpt");
rep_doc.Load(sReportPath);
rep_doc.Refresh();
for (int i = 0; i < rep_doc.Subreports.Count; i++)
{
rep_doc.Subreports.SetDataSource(MyDataTable);
}
SetSelectionFormula_Target();
*****************************************
This is the exception
*****************************************
Exception of type 'System.OutOfMemoryException' was thrown. ### at
System.Data.Common.DecimalStorage.SetCapacity(Int32 capacity) at
System.Data.DataColumn.SetCapacity(Int32 capacity) at
System.Data.RecordManager.set_RecordCapacity(Int32 value) at
System.Data.RecordManager.GrowRecordCapacity() at
System.Data.RecordManager.NewRecordBase() at
System.Data.DataTable.NewUninitializedRecord() at
System.Data.RecordManager.CopyRecord(DataTable src, Int32 record, Int32 copy)
at System.Data.RecordManager.ImportRecord(DataTable src, Int32 record) 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) at ShowReports.GenerateReport() in c:\projects\Copy of
GenevaCrystal\ShowReports.aspx.cs:line 146
*********************************************
 
Top