on 09-11-2008 10:13 PM
Iu2019m having problems when exporting more than 1 million rows of data to a CSV format. Iu2019m running the export from C# code (see sample code below). Depending on the template that I use, I get either a System.OutOfMemoryException or a System.Runtime.InteropServices.COMException (Invalid pointer) error. See the full error text below.
This worked fine with Crystal XI but now breaks with Crystal 2008.
Is this a known problem and are there any workarounds?
Sample Code:
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load("C:\somereport.rpt");
ExportOptions opts = new ExportOptions();
opts.ExportDestinationType = ExportDestinationType.DiskFile;
DiskFileDestinationOptions destOpts = ExportOptions.CreateDiskFileDestinationOptions();
destOpts.DiskFileName = "C:\outputfile.csv";
opts.ExportDestinationOptions = destOpts;
opts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
rptDoc.Export(opts);
Configuration:
Crystal Reports 2008 (Full Version)
C#
.NET 3.5
VS 2008
Exceptions:
System.Runtime.InteropServices.COMException occurred
Message="Invalid pointer\r"
Source="Analysis Server"
ErrorCode=-2147467259
StackTrace:
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)
System.OutOfMemoryException occurred
Message="Exception of type 'System.OutOfMemoryException' was thrown."
Source="CrystalDecisions.ReportAppServer.Controllers"
StackTrace:
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)
Hi, Skip;
The first thing I need to know is if you have installed Service Pack 0 for Crystal Reports 2008. If not, you can download it here:
https://smpdl.sap-ag.de/~sapidp/012002523100007528552008E/cr2008_sp0.zip
Regards,
Jonathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you got a solution for this? I encountered exceptions recently too, using Crystal Report Basic for Visual Studio 2008, exportToDisk to create a large reportdocument to rpt or pdf etc. Thanks advance for sharing!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yogesh
Any update on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to let you know, it is not just Skip getting this problem. I am getting both of the error messages Skip is. However I am running it as a web application. The machine is running 32bit Windows Server 2003 R2 with 4 gig of memory. If I export a large document to word (297 pages) format into a memory stream I get a system out of memory exception. If I try writing it to a file I get an invalid pointer exception. I am using the version Of CR that comes with Visual Studio 2008 although the report itself was created with CR10
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have just competed an export to csv from a table that had 2,000,000 records. Now, it is a simple dbf file with two fields. Both fields are on the report. This results in a report that has 25,710 pages
The export produces a csv file that has a size of 64,365 KB.
The report with saved data has a size of 23,305 KB.
An attempt to open the csv file in excel, results in the error:
"File not loaded completely"
In the information about the error, it states in part:
"The file contains more than 1,048,576 rows..."
And that makes sense as I'd expect 2,000,000 records / rows. Opening the csv file in notepad is successful.
So, the obvious question; What is the difference between your data and report and mine? Do you have SP 0 applied? Can you do the same export inthe CR designer?
Ludek
Jonathan,
I installed Service Pack 0 and am still getting the same errors. Unfortunately it did not fix the problem.
Thanks,
Skip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Skip,
Just to test, can you try viewing the report and try to export using the Viewer Control? Does it work? How does it behave if exported to other formats? Is this issue in dev or production machine?
Would you like to try this method:
ReportDocumentObject.ExportToDisk(ExportFormatType.CharacterSeparatedValues,
"c:\\temp\\myRpt.csv");
Does this help?
Thanks.
Edited by: AG on Sep 13, 2008 3:08 AM
Edited by: AG on Sep 13, 2008 3:09 AM
Iu2019ve tried testing several different scenarios, with mixed results:
Export from Report Designer, CSV Format - Success
C# - ReportDocument.Export(), CSV Format u2013 Failed
C# - ReportDocument.Export(), PDF Format u2013 Failed
C# - ReportDocument.ExportToDisk(), CSV Format u2013 Failed
Report Viewer u2013 Click Export Button, PDF Format u2013 Failed
The only thing that worked was exporting from the report designer.
Thanks,
Skip
1) Is this a large amount of data issue? (E.g.; can you export smaller data subset to CSV - say 100 or 1000 records?). If this starts to look like a number of records issue, can you determine the breaking point (plus / minus)?
2) Look in your temp directory. If you see temp report files there (which we do create), delete those and try the export again
3) Is it possible you are running out of HD space?
Ludek
This is definitely a size issue. I am able to export about 1.1 million rows successfully. When I export 1.3 million rows, it breaks. When I do a successful export with 1.1 million rows, the resulting CSV file size ends up being about 217mb.
I tried clearing out the temp files and still get the error message. When I run the 1.3 million export, it looks like 7 or 8 temp files get created. There are three large files ranging in size from 10mb to 392mb. They are named ~cpe{guid-like-number}.tmp.
I have tried this on multiple machines, with the same failure on each machine. But HD space is not a problem.
Thanks,
Skip
I don't remember where this ended up...
But, what version of CR are you using?
What CR updates have you applied?
Are you getting the issue when exporting, or opening the file in Notepad, or Xls?
Are you able to determine a limit at which you do not get the error?
From the thread it appears that a number of records was not the issue, but perhaps the number of fields / characters per record was. Are you seeing your issue with number of records or number of fields. E.g.; if you can define the limiting parameters, that would be great.
Also, are you able to do the export successfully from the CR designer?
Ludek
Hello Ludek, Thanks for the reply.
I am using 'Crystal Report Basic For Visual Studio 2008 - version 10.5' version of the Crystal Report.
I have 12 columns in my Report. Out of these 12 columns 2 columns display images (one is of size 320X240 and second one is of size 120X240).
Some description is as :-
When Report contain 1180 events, and when I export it as .xls( Size - 21, 492 KB i.e near about 22.5 MB) and .pdf ( Size :- 153,961 KB i.e near about 154MB) it get export properly without an error.
When Report contan 1451 events, and when I export it as .xls (size :- 26,644 KB i.e. Near about 26.6MB) it export properly without an error. But if I try to export it as .pdf it gives " Invalid Pointer" exception.
When Report contain 2813 events and when I export it as .xls (size :- 13, 957 KB) it get export properly without an error but this xls file does not contain the images. (If you look into size of xls for 1451 Events Report and 2813 Events Report, xls for 2813 Events Report has lower size than 1451 Events Reports, because it does not contain the images.) If I export this Report as .pdf , it gives "Invalid Pointer" exception.
I used my own code to export the report in various formats.
What should be done to export the large sized Reports in all possible formats?
Thanks in advance.
Edited by: YogeshP on Sep 2, 2009 2:20 PM
I am not sure. Let me dig a bit around here for some details. Meanwhile, I want you to download SP 1 for CR 10.5 from here:
https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe
Let me know if the SP helped.
Ludek
Hello Ludek,
Thank you for the link and reply. But my client is using 'Crystal Report Basic For Visual Studio 2008 - Version 10.5' version (which come with Visual Studio 2008). It may possible that they will not switch to SP1 for CR 10.5. So I would like to know if it is possible in the current installed version of CR or not. Meanwhile I will try with SP1 for CR 10.5.
I would like to appreciate your help. Thanks in advance.
Thanks Ludek for your help.
If it works with 'Crystal Report 2008 SP1' it would be nice, but unfortunately if it doesn't, then I suppose to move with default 'Crystal Report Basic For Visual Studio 2008 - 10.5 Version'. So, can you please tell me from where I can download this
'Crystal Report Basic For Visual Studio 2008 - 10.5 Version' (which comes with Visual Studio)?
Thanks in advance.
Hi Ludek,
I uninstalled 'Crystal Report Basic For Visual Studio 2008 (10.5 version)' and installed 'Crystal Report Basic For Visual Studio 2008 Service Pack 1'. But after installation, my Registry does not contain 'CR Ent' node and its value under 'Business Objects -> 10.5 -> Crystal Reports -> Keycodes'. Also, registry does not contain 'Crystal Decisions' tag and its all sub-nodes.
Also, my .rpt files created with previous version does not has logo of Crystal Report. Even I can't create new Crystal Report from VS2008 workspace. When I run my application which has CR created with previous version , it says CrystalDecision dlls are missing. When I check them, these dlls are present in the Program Files folder.
Whats wrong am I doing? How can I work with this new SP1 version?
Thanks in advance.
Well, since I did not receive a reply since September, I assume the issue was resolved then. I'd like to suggest you create a new thread, provide as much info as possible and let's tackle it from htere.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.