0
votes

i am trying to get my report viewer on winforms to load a crystal report file, when i test it on my visual studio it runs all fine, but once i publish it, it gives me this error

 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: 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

Below is my code used to load the report file

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

I am quite sure it has to do with the load directory, as it is not embedded but i don't know the proper way to set the path so that it finds the file after publish.

1

1 Answers

0
votes

try to install runtime on machine where you want to run your app.

32 bit

64 bit