C# Crystal Decisions Report Document Initialize Fails

0

I have a Win10 C# Desktop Forms application that wants to display a crystal report. I am using VS2019 and installed the Crystal Reports Developer Edition for Visual Studio 2019 from here: https://www.tektutorialshub.com/crystal-reports/download-crystal-reports-for-visual-studio-2019/

Currently the report runs correctly in a VB6 application with Crystal version 8. We want to upgrade the application to C# and upgrade the Crystal to SAP Crystal Reports 2913. The version 8 report loads in version 2013 designer without error.

The code compiles in debug without error. When it run it fails at the statement:

ReportDocument Rpt1 = new ReportDocument();

and the Catch routine is not invoked.

The error is: The program '[20328] BidHistory.exe' has exited with code -1073740771 (0xc000041d).

        try
        {
            string SQL = CreateGsJobCostMainQuery(work, suff);
            DataTable dt1 = GetDataTable(SQL);
            string SQL_SUB = CreateGsJobCostSubQuery(work, suff);
            DataTable dt2 = GetDataTable(SQL_SUB);

            ReportDocument Rpt1 = new ReportDocument();   //FAILS HERE
            Rpt1.Load(@"C:\Current_Programs\Bid_History\GS_JOBCOST_4.rpt");
            Rpt1.DataSourceConnections.Clear();
            Rpt1.SetDataSource(dt1);
            Rpt1.Subreports[0].DataSourceConnections.Clear();
            Rpt1.Subreports[0].SetDataSource(dt2);

            CrystalReportViewer view1 = new CrystalReportViewer();
            {
                view1.ReportSource = Rpt1;
                view1.Refresh();
            }
        }
        catch ( Exception e )
        {
            MessageBox.Show(e.Message.ToString());
        }
c#
crystal-reports
asked on Stack Overflow Feb 11, 2021 by Hal Weitzman

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0