【问题标题】:Crystal report not loading on published softwareCrystal 报表未加载到已发布的软件上
【发布时间】:2016-08-18 18:06:54
【问题描述】:

我试图让我在 winforms 上的报告查看器加载一个水晶报告文件,当我在我的 Visual Studio 上测试它时它运行得很好,但是一旦我发布它,它就会给我这个错误

 See the end of this message for details on invoking 

即时 (JIT) 调试而不是此对话框。

**************异常文本************** CrystalDecisions.Shared.CrystalReportsException:加载报告失败。 ---> System.Runtime.InteropServices.COMException:不支持的操作。 JRC 引擎处理的文档无法在 C++ 堆栈中打开。 在 CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(对象和 DocumentPath,Int32 选项) 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(对象和 DocumentPath,Int32 选项) 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() --- 内部异常堆栈跟踪结束 --- 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(字符串文件名,OpenReportMethod openMethod,Int16 parentJob) 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String

下面是我用来加载报告文件的代码

 ReportDocument cryRpt = new ReportDocument();
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        Tables CrTables;

        PayrollRep payrollrep = new PayrollRep();


        string myreportname = payrollrep.Name;

        cryRpt.Load(Application.StartupPath + "\\PayrollRep.rpt");
        ////cryRpt.Load("PayrollRep.rpt");

        crConnectionInfo.ServerName = "xxxxx";
        crConnectionInfo.DatabaseName = "xxxx";
        crConnectionInfo.UserID = "xxxx";
        crConnectionInfo.Password = "xxxx";

        CrTables = cryRpt.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }

        crystalReportViewer1.ReportSource = cryRpt;
        crystalReportViewer1.Refresh();

我很确定它与加载目录有关,因为它没有嵌入,但我不知道设置路径以便在发布后找到文件的正确方法。

【问题讨论】:

    标签: c# crystal-reports


    【解决方案1】:

    尝试在您要运行应用的机器上安装运行时。

    32 bit

    64 bit

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-03-27
    • 2013-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多