Исключение при запуске Crystal Report на клиентском компьютере. - PullRequest
0 голосов
/ 22 апреля 2019

После установки приложения Windows на C # на компьютере моего клиента с помощью щелчка один раз после развертывания все работает нормально, за исключением раздела «Отчеты», в котором используется Crystal Report.Ниже приведено исключение, как только попытка загрузки отчета:

************** 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.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
   at Application.Screens.Report.cmbAfterSel_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ComboBox.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)

Ниже приведен код для cmbAfterSel_SelectedIndexChanged

                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No data found for the selected criteria", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    CrystalReport1 CR = new CrystalReport1();
                    CR.Load(@"C:\Users\User\Documents\Visual Studio 2010\Projects\Project1\Project1\CrystalReport\CrystalReport1.rpt");
                    CR.SetDataSource(dt);

                    crystalReportViewer1.ReportSource = CR;
                    crystalReportViewer1.RefreshReport();
                }

Я уже установил механизм выполнения Crystal Reports для .net framework.

В идеале отчет должен открываться с данными, поступающими из базы данных (SQL Server 2012 Express).Отчеты работают нормально на моем ПК, где была завершена разработка.

...