0

I know this question has been asked many times but none of those has solved my problem. I am new in windows application. I am showing some records in Crystal reports. Here is my code...

ReportDocument rptDoc = new ReportDocument();
ds = new InstallationReport();
ds = PrintInstallationReport();
ds.Tables[0].Merge(ds.Tables[0]);
//string AppPath = Environment.CurrentDirectory + "\\Reports\\InstallationReport.rpt";
//rptDoc.Load(AppPath);
                //rptDoc.Load(@"F:\vs10\Windows\RapidDiagnostic\RapidDiagnostic\Reports\InstallationReport.rpt");
rptDoc.Load(Application.StartupPath + "\\Reports\\InstallationReport.rpt");
rptDoc.SetDataSource(ds.Tables[0]);
crystalReportViewer1.ReportSource = rptDoc;
crystalReportViewer1.Refresh();

It's working fine. But when I installed it to another computer it does not work and shows the following error...

Load Report Failed. A document processed by the JRC engine cannot be opened in the C++ stack

I can understand, this error occurred when application does not find the desired report. But what is wrong with my code. Please help guys...

Shaiwal Tripathi
  • 601
  • 1
  • 12
  • 32
  • Does the other computer have access to \\reports\\installationreport.rpt? can you make your code point to c:\installationreport.rpt instead and see if that works better? Also, is the file already open by another computer? – Sun Feb 13 '17 at 23:27
  • @Sun You mean to say, I should put my reports to root folder not `reports` folder ? It works fine when I call the report direct by giving path like `@c:\installationreport.rpt`. But fails when I use `Application.Startup+"\\Reports\\InstallationReport.rpt"` – Shaiwal Tripathi Feb 13 '17 at 23:32
  • UNC path means the report is on the network. So, the new computer needs access to it. This is to test your code and eliminate the network path to isolate where your issue is coming from. Can you open the report from Windows Explorer from new workstation? – Sun Feb 13 '17 at 23:35
  • Yes it works fine when I use something like `c:\installationreport.rpt` – Shaiwal Tripathi Feb 13 '17 at 23:39
  • Well, you know then it is not your code. It has to do with the network path being inaccessible, or the file is already open/being used. – Sun Feb 13 '17 at 23:41
  • Is it any permission issue ? What should I do ? – Shaiwal Tripathi Feb 13 '17 at 23:45
  • Sorry I do not know. I think your question is too localized to determine. If and when you figure out your answer, please post your answer and mark it an answer. – Sun Feb 13 '17 at 23:46
  • @Sun I checked my Installation Destination Folder. When I installed this application. The destination folder (c:\Program Files\MyProjectName) does not contain any folder named `Report`. Can you help me please ? – Shaiwal Tripathi Feb 14 '17 at 00:45
  • You save application data to another directory in windows called AppData %AppData% – Sun Feb 18 '17 at 07:19
  • Possible duplicate of [A document processed by the JRC engine cannot be opened in the C++ stack](https://stackoverflow.com/questions/10833894/a-document-processed-by-the-jrc-engine-cannot-be-opened-in-the-c-stack) – lee-m Sep 18 '17 at 15:40

0 Answers0