使用水晶报告创建设置文件! [英] Creating a setup file with crystal reports !

查看:51
本文介绍了使用水晶报告创建设置文件!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#和MS Access创建了一个解决方案,在应用程序中我已经构建了2个水晶报告。应用程序中没有任何语义,语法或逻辑错误错误。我可以在VS 2010 Ultimate中成功运行该应用程序。但是在创建安装文件后,我无法生成水晶报告,因为显示以下错误。



您的应用程序中发生了未处理的异常....... ...........................



加载报告文件。



有关调用

实时(JIT)调试而不是此对话框的详细信息,请参阅此消息的结尾。



**************异常文本**************

CrystalDecisions.Shared.CrystalReportsException:加载报告失败.---> System.Runtime.InteropServices.COMException(0x80041811):不支持的操作。由JRC引擎处理的文档无法在C ++堆栈中打开。

at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath,Int32 Options)

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath,Int32 Options)
$ b Cr的$ b ystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

---内部异常堆栈跟踪结束---

在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)位于C:\ Users \Administrator \Documents\Visual Studio 2010 \Projects\LankaLab \LankaLab \ rptFbcView.cs:第82行

在System.Windows.Forms.Form.OnLoad(EventArgs e)

在System.Windows.Forms.Form.OnCreateControl()
$ b System.Windows.Forms.Control.CreateControl上的$ b(布尔值fIgnoreVisible)
System.Windows.Forms.Control.CreateControl()上的

System.Windo上的
ws.Forms.Control.WmShowWindow(消息&安培; m)

在System.Windows.Forms.Control.WndProc(Message& m)

在System.Windows.Forms.ScrollableControl.WndProc(Message& m)
(消息& m)
System.Windows.Forms.Form.WmShowWindow上的
(消息& m)
$ b System.Windows.Forms.Form.WndProc上的$ b(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)





**************已装载的装配************ **

mscorlib

汇编版本:2.0.0.0





。 .................................................. .................................................. ............................................



等等。对于安装解决方案,我已经添加了所有表单,.rpt文件,.mdb,即数据库文件和其他必要文件。



在安装应用程序之前我已经安装了.netframework 4.0,用于x86 32位的Crystalreports运行时等等。



如果有人可以帮我解决我的问题。



用于查看水晶报告的表格之一如下



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)
        {
             //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;

                            
        }
    }
}





< u>如果有人可以帮我解决我的问题。

推荐答案

此错误是由于代码上给出的静态文件路径引起的

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





您可以更改声明



you can change your declaretion

//creating an object of Report Document class
ReportDocument reportDocument = new ReportDocument();



to


to

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





然后删除



then remove

  //preparing root for preview
reportDocument.Load("FBCReport.rpt"); // remove this 


这篇关于使用水晶报告创建设置文件!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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