为此一夜之间打破了我的头。无法从早期论坛获得任何帮助。
我的应用程序可以在其他计算机上顺利运行,现在已经在五个客户端上安装了,没有任何问题。在这台新计算机上,打开报告时,我一直收到“加载报告失败” 。之后,CR Viewer只是空白。
更新:我已经检查了权限,该应用程序可以在temp文件夹中创建临时文件。但是在我的开发机上,它会创建2个文件(另一个文件上有花括号),在这台特定的客户端计算机上(发生错误的地方),它只会创建一个文件。
我将bin文件夹内容复制到客户端计算机。对于 Build Action ,报告设置为 Embedded Resource ,对于 Copy to Output Directory ,报告设置为 Do not Copy 。多年来,此设置运行平稳,在其他客户端计算机上没有任何问题。我没有更改报告检索代码中的任何内容。
这是我一直在使用的示例代码:
Try
Dim CR As New CRInventory
CR.SetDataSource(DataTable)
CR.SetParameterValue("GeneratedBy", ActiveStaffMember.Fullname)
CR.SetParameterValue("BusinessDetails", BusinessName & ", " & BusinessAddress)
CR.SetParameterValue("ReportDate", ReportDate)
CRV.ReportSource = CR
Catch ex As TypeInitializationException
ShowApplicationRuntimeErrorNotebox("LoadReport TypeInitializationException", ex.InnerException.Message)
Catch ex As Exception
ShowApplicationRuntimeErrorNotebox("LoadReport", ex.Message)
End Try
那么这台计算机有什么新功能?我不知道,我猜它是否具有最新的Windows更新?
请提供任何帮助。我已经快要把这台新计算机扔到窗外了。
更新:使用 ex.tostring 而不是 ex.Message 来以某种方式捕获错误(感谢Seb),结果出来了: / p>
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: The document has not been opened.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ReportAppServer()
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ReportAppServer()
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
at Iceberg.FItemInventoryReportB.LoadReport() in D:\Documents\Iceberg\Iceberg VS2017\Iceberg\Forms\Items\Inventory\Inventory Transactions\FItemInventoryReportB.vb:line 38
更新:使用 procmon.exe 来监视报告加载期间应用程序的文件系统活动。所有结果均为成功。除非我在错误的树上吠叫。