0
votes

I created a system for a family member, it is for a small shop only one pc. So now that the program is finished im trying to get it to work on his pc but i keep getting a load report error.

-- I did a bit of debugging and it came to a point where i know the error happens when the program wants to execute the .load

here is my code for the report

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

    }
}

}

and here is the error message

************** Exception Text ************** CrystalDecisions.Shared.CrystalReportsException: Load report failed. --->

System.Runtime.InteropServices.COMException: The document has not been opened. at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ReportAppServer() at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ReportAppServer() 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 Taksidermie.Form3..ctor(Int32 _faktuurno) in D:\Program
Files\Taksidermie\Taksidermie\Form3.cs:line 33 at Taksidermie.frmMainScreen.InvoiceToolStripMenuItem_Click(Object sender, EventArgs e) in
D:\Program
Files\Taksidermie\Taksidermie\Form1.cs:line 345 at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

i have been looking for solutions but i cant find any

what i have tried is i made sure that the debugging is set to 64bit not any CPU i Changed the path to ensure it goes to the correct folder for the report and gave everyone access to the file

along with that one of the solutions i got to said the program does not have access to my Temp folder. So i also gave access to that but still nothing. But every time i test on my computer it works and every other machine i test on give the load report error

1
I might have found a solution it seems my pc has a newer version of Crystal Reports so im taking that approach nowReinhard Engelbrecht

1 Answers

0
votes

Have you installed the Crystal Report Runtime Redistributable Package on the computer that will be running the software?

If you have debugging set to Any CPU the installation will require both the 32-bit and 64-bit version of the redistributable package. If debugging is set to 64-bit then you only need to install the 64-bit redistributable package.

Also keep in mind the version of the package will be determined by the version of the Crystal Report Designer used to create the report.