Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to export crystal report to pdf using oracle
    primarykey
    data
    text
    <p>I get an InvalidComObjectException error when trying to export to pdf. I think it might have something to do with connecting to oracle, but not sure. The SetDatabaseLogon seem to favor Sql Server. The report calls a stored proc for the data, and is working using the Business Objects XIR2 service. I can view the report and connect inside the designer also.</p> <p>'CrystalDecisions.CrystalReports.Engine 13.0.2000.0 'Crystal Reports for .NET Framework 4.0</p> <pre><code>Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.ReportAppServer.DataDefModel Imports CrystalDecisions.Shared Imports CrystalDecisions.ReportSource Public Overloads Function CreateReport(ByVal reportFileName As String, ByVal reportTitle As String, ByVal outputDirectory As String, _ ByVal isFullPath As Boolean, ByVal outputFormat As OutputFormat, ByVal crystalParameter As CrystalParameter) As String Dim baseReportsSourcePath As String = "C:\ADSTAX\SUITES\RFL\Letters\" Dim baseReportsOutputPath As String = "C:\PDF_Exports\" Dim fullFilepath As String = baseReportsSourcePath + reportFileName 'check report exists If File.Exists(fullFilepath) = False Then Throw New FileNotFoundException("File:" + fullFilepath + " does not exist", fullFilepath) Dim doc As ReportDocument = New ReportDocument() doc.Load(fullFilepath) 'set parameters If crystalParameter.Name = CrystalParameterName.DistributionKey Then doc.SetParameterValue("DISTRIBUTIONKEY", crystalParameter.Value) ElseIf crystalParameter.Name = CrystalParameterName.RequestKey Then doc.SetParameterValue("REQUESTKEY", crystalParameter.Value) End If 'user, pass, server, database doc.SetDatabaseLogon("user", "pass") 'build full output filename Dim exportFileName As String = Path.GetFileNameWithoutExtension(reportFileName) exportFileName += Guid.NewGuid.ToString + ".pdf" Dim fullOuputFilePath As String = baseReportsOutputPath + exportFileName 'export to pdf doc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fullOuputFilePath) 'check report created If File.Exists(fullFilepath) = False Then Return String.Empty End If Return fullOuputFilePath End Function </code></pre> <p>Error Below:</p> <pre><code>System.Runtime.InteropServices.InvalidComObjectException was unhandled Message=COM object that has been separated from its underlying RCW cannot be used. Source=mscorlib StackTrace: at System.StubHelpers.StubHelpers.StubRegisterRCW(Object pThis, IntPtr pThread) at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Unadvise(Int32 dwCookie) at CrystalDecisions.ReportAppServer.ISCDClientDocumentEvents_EventProvider.RemoveOnClosed(_ISCDClientDocumentEvents_OnClosedEventHandler handler) at CrystalDecisions.ReportAppServer.ISCDClientDocumentEvents_EventProvider.remove_OnClosed(_ISCDClientDocumentEvents_OnClosedEventHandler value) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.DisconnectEventRelay() at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.InternalClose(Boolean bSetupForNextReport, Boolean bAutoClose) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean bDisposeManaged) at System.ComponentModel.Component.Dispose() at CrystalDecisions.CrystalReports.Engine.ReportDocument.ClearCache(Boolean clearDocument) at CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalClose(Boolean bSetupForNextReport) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close() at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExitHandler(Object sender, EventArgs e) InnerException: </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload