Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a solution using C# and MS Access and in the application I have built 2 crystal reports. There are no any errors in the application either semantic, syntax or logical errors. I can successfully run the application within the VS 2010 Ultimate. But after creating the setup file I cannot generate the crystal report because the following error is displaying.

"Unhandled exception has occurred in your application..................................

Load report faild.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80041811): Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
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.ReportDocument.Load(String filename)
at LankaLab.rptFbcView.rptFbcView_Load(Object sender, EventArgs e) in C:\Users\Administrator\Documents\Visual Studio 2010\Projects\LankaLab\LankaLab\rptFbcView.cs:line 82
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0


................................................................................................................................................. "

and so on. To the setup solution I have added all the forms, .rpt files, .mdb i.e. the database file and other necessary files too.

Before the application is being installed I have installed the .netframework 4.0, Crystalreports runtime for x86 32 bit and so on.

If someone can please help me to solve my problem.

One of the forms that use to view the crystal report is as the following

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

namespace LankaLab
{
    public partial class rptFbcView : Form
    {
        public rptFbcView()
        {
            InitializeComponent();
        }

        private void rptFbcView_Load(object sender, EventArgs e)
        {
             //creating an object of Report Document class

            ReportDocument reportDocument = new ReportDocument();

 

            //creating an object of ParameterField class

            ParameterField paramField = new ParameterField();

 

            //creating an object of ParameterFields class

            ParameterFields paramFields = new ParameterFields();

 

            //creating an object of ParameterDiscreteValue class

            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

           

            //set the parameter field name

            paramField.Name = "ParaPatID";

 

            //set the parameter value

            paramDiscreteValue.Value = CommonVariables.StrSuperPatID;

 

            //add the parameter value in the ParameterField object

            paramField.CurrentValues.Add(paramDiscreteValue);

 

            //add the parameter in the ParameterFields object

            paramFields.Add(paramField);

            //set the parameterfield information in the crystal report

           // crystalReportViewer1.ParameterFieldInfo = paramFields;
            rptvFbc.ParameterFieldInfo = paramFields;

 
            //preparing root for preview

            reportDocument.Load("FBCReport.rpt");              
            rptvFbc.ReportSource = reportDocument;

                            
        }
    }
}


If someone can please help me to solve my problem.
Posted

1 solution

This Error is due to static file path given on the code
C#
reportDocument.Load("FBCReport.rpt");


you can change your declaretion
C#
//creating an object of Report Document class
ReportDocument reportDocument = new ReportDocument();

to
C#
//creating a new Report (FBCReport.rpt)
ReportDocument reportDocument = new FBCReport.rpt;


then remove
C#
  //preparing root for preview
reportDocument.Load("FBCReport.rpt"); // remove this 
 
Share this answer
 
v2

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