The application runs slowly when database registration information is applied to each section of Crystal Reports

Currently, I am using the following method to assign connection information to all sections of a report. But since the report has many sections, the report is displayed after almost 10 seconds. Which looks very slow. Is there any other method by which we can set the login information for each CR once and for all, when it is installed on the client side.

JFYI : all CR connections connect to the same database with the same credentials. Thank you in advance.

   readDiamondBillReport = new RealDiamondBill();
                        crConnectionInfo.ServerName = db.Connection.DataSource;
                        crConnectionInfo.DatabaseName = db.Connection.Database;
                        crConnectionInfo.UserID = "client";
                        crConnectionInfo.Password = "client";
                        crConnectionInfo.IntegratedSecurity = false;

                        CrTables = readDiamondBillReport.Database.Tables;
                        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                        {
                            crtableLogoninfo = CrTable.LogOnInfo;
                            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                            CrTable.ApplyLogOnInfo(crtableLogoninfo);
                        }

                        Sections crSections2 = readDiamondBillReport.ReportDefinition.Sections;
                        // loop through all the sections to find all the report objects 
                        foreach (Section crSection in crSections2)
                        {
                            ReportObjects crReportObjects = crSection.ReportObjects;
                            //loop through all the report objects in there to find all subreports 
                            foreach (ReportObject crReportObject in crReportObjects)
                            {
                                if (crReportObject.Kind == ReportObjectKind.SubreportObject)
                                {
                                    SubreportObject crSubreportObject = (SubreportObject)crReportObject;
                                    //open the subreport object and logon as for the general report 
                                    ReportDocument crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);

                                    Tables SubCrTables = crSubreportDocument.Database.Tables;
                                    foreach (CrystalDecisions.CrystalReports.Engine.Table SubCrTable in SubCrTables)
                                    {
                                        crtableLogoninfo = SubCrTable.LogOnInfo;
                                        crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                                        SubCrTable.ApplyLogOnInfo(crtableLogoninfo);

                                    }
                                }
                            }
                        }

                        readDiamondBillReport.Refresh();
+3
source share
3 answers

- , , . , .

10 , . , :

  • . 1 , , 8-10 .

  • , , .

  • " " . VS .

  • Crystal Reports CrystalReportViewer, objrpt.PrintToPrinter 500 .

, -.

+3

, , Crystal Reports. "pull", Crystal Report, "" , .

, "push". Crystal Report XSD Crystal Report. .NET XSD , . , .

, ( ) ( , ..).

, , .NET .

, , .

+3

Each report has a collection of subscriptions.

You can enter information to enter the tables of each subreport, rather than looking for subheadings in each section.

Here is the code

private void showrep(string repName)
        {
            rd = new ReportDocument();
            rd.Load(pth+"\\"+repName);
            LogInInfo();

            crv.ReportSource = rd;  // crv is the reportviewer
            crv.Show();
        }

        private void LogInInfo()
        {
            MyApp.Properties.Settings s = new MyApp.Properties.Settings();
            TableLogOnInfo linfo = new TableLogOnInfo();
            linfo.ConnectionInfo.DatabaseName = s.dbname;
            linfo.ConnectionInfo.UserID = s.usr;
            linfo.ConnectionInfo.Password = s.pw;
            linfo.ConnectionInfo.ServerName = s.svr;

            foreach (Table t in rd.Database.Tables)
            {
                t.ApplyLogOnInfo(linfo);
            }
            foreach (ReportDocument sr in rd.Subreports)
            {
                foreach (Table t in sr.Database.Tables )
                {
                    t.ApplyLogOnInfo(linfo);
                }
            }
        }

Hope this helps.

+2
source

All Articles