locked
odd report printing problem RRS feed

  • Question

  • In a Windows Forms application written in C# in Visual Studio 2013 Pro, I created two different Crystal Reports reports for printing different labels on two different 'Zebra UPS 2348+' printers installed and connected via USB to my Windows 7 Pro 64-bit PC with 'CRRuntime_64bit_13_0_14.msi' installed. When I run the application in Visual Studio and when I install and run the application on my PC, the labels print as expected with no errors. However, when I connect and install the printers, install 'CRRuntime_64bit_13_0_14.msi', and install and run the application on any other Windows 7 Pro 64-bit PC, one of the printers (see SlotLabel below) throws a 'Failed to open connection...' exception, while the other printer (see OrderLabel below) prints the label as expected with no errors. The printer names, drivers, and settings are exactly the same on the other PCs as they are on mine, but the results consistently differ. Does anyone have any idea why? Code snippets follow.

    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;

                try
                {
                    SlotLabel slRpt = new SlotLabel();
                    slRpt.PrintOptions.PrinterName = "SlotLabels";
                    slRpt.PrintToPrinter(1, false, 0, 0);
                    slRpt.Close();
                    slRpt.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("PrintSlotLabel error: " + ex.Message);
                }


                try
                {
                    OrderLabel olRpt = new OrderLabel();
                    olRpt.PrintOptions.PrinterName = "OrderLabels";
                    olRpt.PrintToPrinter(1, false, 0, 0);
                    olRpt.Close();
                    olRpt.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("PrintOrderLabel error: " + ex.Message);
                }
    • Moved by Youjun Tang Wednesday, September 9, 2015 7:31 AM not supported
    Tuesday, September 8, 2015 1:44 PM

Answers

  • Hi Maunder,

    Microsoft don't provide support for CrystalReport, it's a 3rd-party component now.

    Please post in SAP official Crystal Report site for help:http://forums.sdn.sap.com/forum.jspa?forumID=313

    Thanks for your understanding.

    Regards,
    Youjun Tang



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Youjun Tang Wednesday, September 9, 2015 6:37 AM
    • Proposed as answer by Fouad Roumieh Wednesday, September 9, 2015 7:07 AM
    • Marked as answer by Just Karl Wednesday, September 23, 2015 10:54 PM
    Wednesday, September 9, 2015 6:36 AM

All replies

  • That connection it's erroring on is probably the database connection.

    The way I would work with crystal reports is to grab the data externally and present it to crystal.

    So long as what you give it has the same columns with the same type as the report was designed against, you can substitute a datatable or collection.

     DataTable dt = // get data from somewhere
    //  make the name of the datatable match what the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load( .... the rdl .....)
    rd.SetDataSource(dt);
    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    CrystalReportViewer1.DisplayGroupTree = false;

    As it is at the moment you are presumably using odbc and have an issue with something like the dsnb or permissions.


    Tuesday, September 8, 2015 2:30 PM
  • Andy,

    The data source for each report is a SQL Server 2005 table, which is populated by my application prior to calling the print method. If the connection problem was with the database, I would think neither report would work. The application does not depend on ODBC.

    Tuesday, September 8, 2015 8:57 PM
  • Hi Maunder,

    Microsoft don't provide support for CrystalReport, it's a 3rd-party component now.

    Please post in SAP official Crystal Report site for help:http://forums.sdn.sap.com/forum.jspa?forumID=313

    Thanks for your understanding.

    Regards,
    Youjun Tang



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Youjun Tang Wednesday, September 9, 2015 6:37 AM
    • Proposed as answer by Fouad Roumieh Wednesday, September 9, 2015 7:07 AM
    • Marked as answer by Just Karl Wednesday, September 23, 2015 10:54 PM
    Wednesday, September 9, 2015 6:36 AM