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
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)
{
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "ParaPatID";
paramDiscreteValue.Value = CommonVariables.StrSuperPatID;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
rptvFbc.ParameterFieldInfo = paramFields;
reportDocument.Load("FBCReport.rpt");
rptvFbc.ReportSource = reportDocument;
}
}
}
If someone can please help me to solve my problem.