c#setup上的Crystal报表加载错误 [英] Crystal report load error on c# setup

查看:98
本文介绍了c#setup上的Crystal报表加载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我的c#项目的exe。我正在使用水晶报告进行报告并将Crystal报表运行时作为我的先决条件之一。我已经为VS2008安装了水晶报告运行时。但是

当我想在另一台计算机上查看我的报告时,显示错误。

I have an exe of my c# project.I am using crystal reports for reporting And included Crystal report runtime as one of my prerequisites. i've installed crystal report runtime for VS2008.But
When I wants to view my reports in another computer, shows error.

CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()





我的代码包含以下行:



My code includes this line:

cryrpt.Load("D:\\C# projects\\project\\project1\\CrystalReport7.rpt");

我有一个疑问,即我的exe在不同的计算机的不同位置。如果我从那个位置打开CrystalReport7.rpt我可以查看它吗?如果不是,如何更改路径?

I have 1 doubt, ie my exe is in different computer's different location.If im opening CrystalReport7.rpt from that location can I able to view it? If no,how to change the path ?

推荐答案

U可以拥有当前执行目录表单

U can have the current execution directory form this
string directory = AppDomain.CurrentDomain.BaseDirectory;



然后你必须相应地修改加载路径以访问你的.rpt文件也在发布项目之后你也得到了编译的.rpt文件,也可以和你的exe一起使用它们。


then u have to modify Load path accordingly to access ur .rpt files also after publishing the project u also had got the compiled .rpt file, use them also along with ur exe.


检查这个提示/技巧



Crystal Reports:Fix for加载报告失败错误。 [ ^ ]



编辑


我想在水晶中设置动态路径报告查看器? [ ^ ]



EDIT2


检查应用类 [ ^ ]其中包含很多路径

这里你需要< a href =http://msdn.microsoft.com/en-us/library/system.windows.forms.application.executablepath.aspx> Application.ExecutablePath [ ^ ]或Application.StartupPath [ ^ ]属性



简单提示在调试时你可以查看路径你的代码和根据您的要求做更改,不是什么大不了的事。完成它。



祝新年快乐! :rose:
Check this Tip/Trick

Crystal Reports: Fix for "Load report failed" error.[^]

EDIT

I want to set a dynamic path in crystal report viewer?[^]

EDIT2

Check Application Class[^] which contains many paths
Here you need Application.ExecutablePath[^] or Application.StartupPath[^] Property

Simple Tip is while debugging you can check the path from your code & do changes based on your requirement, not a big deal. Finish it.

Happy new year wishes! :rose:


我有同样的问题
error downloading the fileCrystalDecisions.Shared.CrystalReportsException: Load report failed. 





我的EPR在本地工作正常并保存pdf文件以共享路径但是在将其移至开发后它停止工作并开始显示错误。





解决方案:为您的代码添加异常处理程序以捕获确切的问题

然后如果你看到这个错误在另一个系统上只是从本地复制并将crystalreport.rpt文件粘贴到特定文件夹,就像你在代码中声明路径一样。



它对我有用。希望它可以解决您的问题。



My EPR was working correctly in local and saved the pdf file to share path but after moving it to development it stopped working and started showing error.


Solution: add exception handler to your code to catch exact issue
then if you see this error on another system just copy from local and paste the crystalreport.rpt file to the specific folder like the way you declared the path in your code.

It worked for me. Hope It might resolve your issue.


这篇关于c#setup上的Crystal报表加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆