Hi,
I am developing an ASP.NET application which uses Crystal reports 9. It was
working fine. But later I installed the trial Crystal Report 11. After that
the generating of the reports gives the folowing error

"System.Runtime.InteropServices.COMException: Not enough memory for
operation."

The change of version may not be the actual cause but I cant trace out what
other change I might have done to cause this.

This is my code :
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
----------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim RptFilePath As String
Dim ReportDoc As New ReportDocument
Dim RptExportOpt As CrystalDecisions.Shared.ExportOptions
Dim ExportLocation As New
CrystalDecisions.Shared.DiskFileDestinationOptions
Dim ExportPath As String

RptFilePath = "C:\Report1.rpt"

'this is the line that gives the error:
ReportDoc.Load(RptFilePath)

ReportDoc.Refresh()
ReportDoc.SetDatabaseLogon("myuser", "mypwd", "myserver", "myDB")
ReportDoc.SetParameterValue("From", "qwe")
ReportDoc.SetParameterValue("To", "asd")
' two parameters that are passed to the report

ExportPath = "C:\report.pdf"
ExportLocation.DiskFileName = ExportPath
RptExportOpt = ReportDoc.ExportOptions
With RptExportOpt
.DestinationOptions = ExportLocation
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With

ReportDoc.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(ExportPath)
Response.Flush()
Response.Close()
System.IO.File.Delete(ExportPath)
End Sub

Recommended Answers

All 2 Replies

Check out the business objects Website...for help on Crystal reports

Try installing the full version of crystal XI. It must work. I had the same problem when I installed the trial version, from crystal IIX. Once I got the non-trial version, everything went back to normal. Gd luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.