【问题标题】:How to get crystal reports to load report on client computer如何获取水晶报告以在客户端计算机上加载报告
【发布时间】:2020-01-04 08:21:29
【问题描述】:

我为一个家庭成员创建了一个系统,它是为一个小商店只有一台电脑的。所以现在程序已经完成,我试图让它在他的电脑上运行,但我不断收到负载报告错误。

-- 我做了一些调试,我知道当程序想要执行 .load 时会发生错误

这是我的报告代码

    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Taksidermie.Classes;

    namespace Taksidermie
    {
public partial class Form3 : Form
{
    int FaktuurNo;
    public Form3(int _faktuurno)
    {
        InitializeComponent();
        FaktuurNo = _faktuurno;

        ReportDocument cryRpt = new ReportDocument();


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

        string path = "C:\\Reports\\FaktuurPrintOut.rpt";


        cryRpt.Load(path);


        cryRpt.SetParameterValue("FId", FaktuurNo.ToString());

        crConnectionInfo.ServerName = database.server;
        crConnectionInfo.DatabaseName = database.dbName;
        crConnectionInfo.UserID = database.username;
        crConnectionInfo.Password = database.password;

        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();
    }

    private void CrystalReportViewer1_Load(object sender, EventArgs e)
    {

    }

    private void CrystalReportViewer1_Load_1(object sender, EventArgs e)
    {

    }

    private void Form3_Load(object sender, EventArgs e)
    {

    }
}

}

这是错误信息

**************异常文本************** CrystalDecisions.Shared.CrystalReportsException:加载报告失败。 --->

System.Runtime.InteropServices.COMException:文档尚未打开。 在 CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ReportAppServer() 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ReportAppServer() 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() --- 内部异常堆栈跟踪结束 --- 在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(字符串 文件名,OpenReportMethod openMethod, Int16 parentJob) 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(字符串 文件名) 在 D:\Program
中的 Taksidermie.Form3..ctor(Int32 _faktuurno) 文件\Taksidermie\Taksidermie\Form3.cs:第 33 行 在 Taksidermie.frmMainScreen.InvoiceToolStripMenuItem_Click(对象 发件人,EventArgs e) in
D:\程序
文件\Taksidermie\Taksidermie\Form1.cs:第 345 行 在 System.Windows.Forms.ToolStripItem.RaiseEvent(对象键,EventArgs e) 在 System.Windows.Forms.ToolStripMenuItem.OnClick (EventArgs e) 在 System.Windows.Forms.ToolStripItem.HandleClick (EventArgs e) 在 System.Windows.Forms.ToolStripItem.HandleMouseUp (MouseEventArgs e) 在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) 在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) 在 System.Windows.Forms.Control.WmMouseUp(消息和 m,MouseButtons 按钮,Int32 点击) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ToolStrip.WndProc(消息和 m) 在 System.Windows.Forms.ToolStripDropDown.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr 参数)

我一直在寻找解决方案,但我找不到任何解决方案

我尝试过的是确保调试设置为 64 位而不是任何 CPU 我更改了路径以确保它进入报告的正确文件夹并让每个人都可以访问该文件

连同我得到的解决方案之一,该程序无权访问我的 Temp 文件夹。所以我也给了访问权限,但仍然没有。但是每次我在我的电脑上测试它都能正常工作,而我测试的每台其他机器都会给出负载报告错误

【问题讨论】:

  • 我可能已经找到了解决方案,我的电脑似乎有较新版本的 Crystal Reports,所以我现在采用这种方法

标签: c# crystal-reports


【解决方案1】:

您是否在将运行该软件的计算机上安装了 Crystal Report Runtime Redistributable Package?

如果您将调试设置为任何 CPU,则安装将需要 32 位和 64 位版本的可再发行软件包。如果调试设置为 64 位,则只需安装 64 位可再发行包。

另外请记住,包的版本将取决于用于创建报表的 Crystal Report Designer 的版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多