1
votes

I have problem with run my report on Windows 10.

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions;//.Windows.Forms;
using System.Drawing;
using CrystalDecisions.CrystalReports;


      [STAThread]
        static void Main(string[] args)
        {
            try
            {

                System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA);
            }

            catch (Exception ex)

            {
                Console.WriteLine(ex.ToString());
            }


            ReportDocument report;
            try
            {

                int id = Int32.Parse(args[0]);
                report = new ReportDocument();
                report.Load(ConfigurationService.GetConfig().Localistaion);

                report.SetDatabaseLogon(ConfigurationService.GetConfig().User, ConfigurationService.GetConfig().Password, ConfigurationService.GetConfig().ServerName, ConfigurationService.GetConfig().Database);
                report.SetParameterValue("pInvoiceHeader_Id", id);

                report.PrintToPrinter(2, false, 1, 5);
                Console.ReadKey();

            }
            catch (Exception ex) { Console.WriteLine("{0}: ", ex.ToString()); Console.ReadKey(); }
        }

Failed to open the connection.s.Engine.InternalException: Invoice 6172_11120_{DE173B3A-EEC6-41EF-937D-75576F6BEDCA}.rpt Failed to open the connection.e: 17 ] ---> System.Runtime.InteropServices.COMException: Invoice 6172_11120_{DE173B3A-EEC6-41EF-937D-75576F6BEDCA}.rpt Details: [Database Vendor Code: 17 ] at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetLastPageNumber(RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext reqContext) --- End of inner exception stack trace --- at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.HandleException(Exception exception) at CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) at Prnt2.Program.Main(String[] args):

1

1 Answers

0
votes

wait answear:: database vendor code : 17 failed to open the connection. temp_51c8028b-63ae-4583-b67e-432994f29f554132_3340