Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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:
C#
cryrpt.Load("D:\\C# projects\\project\\project1\\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 ?
Posted
Updated 3-Nov-20 6:38am
v3
Comments
panditramesh 10-Jun-12 7:22am    
how can i solve this probulem when i run crystel report then error this namespace "CrystalDecisions".
lilian87 13-Jun-12 10:48am    
use the namespace-
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

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

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.
 
Share this answer
 
v2
Comments
lilian87 29-Dec-11 3:38am    
Sorry to ask you..
After setup , when i executed
string directory = AppDomain.CurrentDomain.BaseDirectory;
Project exists in bin\release folder.
How to change the path of crystal report accordingly?
amit28august 29-Dec-11 3:53am    
u use string handling functions String.Replace("bin\\release\\","REPORT FOLDER NAME HERE");

take it from ur folder
lilian87 29-Dec-11 9:05am    
i want to change the path of crystal reports used in my form.I'm using 7 crystal reports in this project.So how will I change the path of all crystal reports so that i can access it from another computer??
RaisKazi 29-Dec-11 3:43am    
Edited: Formatted using "pre" tag.
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:
 
Share this answer
 
v3
Comments
lilian87 29-Dec-11 3:40am    
Thanx for reply. But this is not what I want.After setup,in another computer my reports are not running,Its showing error-load report failed.
thatraja 29-Dec-11 9:55am    
Did you read that Tip/Trick fully? There are couple of scenarios.
lilian87 29-Dec-11 10:16am    
ya, iwent through it. I dont have any problem running reports in my computer.When i install project exe in another computer there i cannot open it. It gives the error-load report failed.. Any solution?
thatraja 29-Dec-11 10:25am    
Check the case Invalid File path or File name in that Tip/Trick
Use relative paths(Application's Startup Path or Executable path) instead of hard-code paths. Put your reports files in your application folder.
lilian87 29-Dec-11 11:06am    
I also have the same doubt.Maybe invalid file path. when we click crystalreport.rpt on our solution we get the file path.I used that path in my code.But it specifies to the D: drive of my computer.If I'm running this app on any other computer will it identify this location? instead of using this path how can i change the path specifying 'my computername and the full report path'?
I had the same problem
error downloading the fileCrystalDecisions.Shared.CrystalReportsException: Load report failed. 


My EPR was working correctly in local and saved the pdf file to sharepath but after moving it to dev 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.
 
Share this answer
 
I had the same problem
error downloading the fileCrystalDecisions.Shared.CrystalReportsException: Load report failed. 


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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900