Hi
We have a little application that exports reports to PDF, the code is below. It runs perfectly on our development machine both in VS and when deployed/installed on the development machine. The only problem is that when deployed to another machine it fails with the error below the code.
I have no idea what the problem could be, the database server is the same and the report is the same.
Any advice would be much appreciated.
Thanks
B
CODE
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
Dim CrReport As New ReportDocument
CrReport.Load(Path)
'logon for main reports
For i As Integer = 0 To CrReport.DataSourceConnections.Count - 1
CrReport.DataSourceConnections(0).SetLogon(gstrUsername, gstrPassword)
Next
'logon for sub reports
For i As Integer = 0 To CrReport.Subreports.Count - 1
For j As Integer = 0 To CrReport.Subreports.Item(i).DataSourceConnections.Count - 1
CrReport.Subreports.Item(i).DataSourceConnections(j).SetLogon(gstrUsername, gstrPassword)
Next
Next
CrDiskFileDestinationOptions.DiskFileName = "c:\temp\exportedreport.pdf"
CrExportOptions = CrReport.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
CrReport.Export()
ERROR
CrystalDecisions.CrystalReports.Engine.FormulaException: This field name is not known.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1.FIN\LOCALS~1\Temp\1\{E94BECCD-8E5C-4B61-A8B6-113F591FC34A}.rpt:
Error in formula <Today>.
'//CurrentDate
'
This field name is not known.
Details: errorKind ---> System.Runtime.InteropServices.COMException (0x80041019): This field name is not known.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\{E94BECCD-8E5C-4B61-A8B6-113F591FC34A}.rpt:
Error in formula <Today>.
'//CurrentDate
'
This field name is not known.
Details: errorKind
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
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.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at EmailCrystal.Main.subExecuteReport(String arg)
We have a little application that exports reports to PDF, the code is below. It runs perfectly on our development machine both in VS and when deployed/installed on the development machine. The only problem is that when deployed to another machine it fails with the error below the code.
I have no idea what the problem could be, the database server is the same and the report is the same.
Any advice would be much appreciated.
Thanks
B
CODE
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
Dim CrReport As New ReportDocument
CrReport.Load(Path)
'logon for main reports
For i As Integer = 0 To CrReport.DataSourceConnections.Count - 1
CrReport.DataSourceConnections(0).SetLogon(gstrUsername, gstrPassword)
Next
'logon for sub reports
For i As Integer = 0 To CrReport.Subreports.Count - 1
For j As Integer = 0 To CrReport.Subreports.Item(i).DataSourceConnections.Count - 1
CrReport.Subreports.Item(i).DataSourceConnections(j).SetLogon(gstrUsername, gstrPassword)
Next
Next
CrDiskFileDestinationOptions.DiskFileName = "c:\temp\exportedreport.pdf"
CrExportOptions = CrReport.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
CrReport.Export()
ERROR
CrystalDecisions.CrystalReports.Engine.FormulaException: This field name is not known.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1.FIN\LOCALS~1\Temp\1\{E94BECCD-8E5C-4B61-A8B6-113F591FC34A}.rpt:
Error in formula <Today>.
'//CurrentDate
'
This field name is not known.
Details: errorKind ---> System.Runtime.InteropServices.COMException (0x80041019): This field name is not known.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\{E94BECCD-8E5C-4B61-A8B6-113F591FC34A}.rpt:
Error in formula <Today>.
'//CurrentDate
'
This field name is not known.
Details: errorKind
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
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.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at EmailCrystal.Main.subExecuteReport(String arg)