将 DB 日志记录信息应用于每个 Crystal Reports 部分时,应用程序运行缓慢 [英] Application runs slow when DB logging info is applied to each Crystal Reports Sections

查看:11
本文介绍了将 DB 日志记录信息应用于每个 Crystal Reports 部分时,应用程序运行缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我使用以下方法将连接信息分配给所有报告部分.但由于我在报告中有很多部分,报告会在将近 10 秒后显示.这看起来真的很慢.当它安装在客户端时,是否有其他方法可以一劳永逸地为每个 CR 设置登录信息.

Currently I use the following method to assign connection info to all the report sections. But as I have many sections in the report, the report is displayed after almost 10 seconds. Which looks really slow. Is there some other method by which we can set logon information to each CR once and for all when it is installed at client side.

JFYI:所有 CR 都使用相同的登录凭据连接到同一个数据库.提前谢谢你.

JFYI: All the CRs connect to same DB, with same login 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();

推荐答案

我终于发现,应用登录信息都不是问题,刷新报告也不是问题.但这是我用来在水晶报表中设置水印的大型图片对象.

I finally found that, neither applying logon info was the issue nor refreshing the report was. But it was my large picture object which I used for setting a watermark in crystal reports.

我有 10 份使用此图片作为水印的报告.我删除了带水印的图像,现在解决了以下问题:

I had 10 reports which used this Image as watermark. I removed the watermarked image and now following problems are solved:

  1. 项目构建非常非常快.以前构建需要大约 1 分钟,现在已大幅减少到 8-10 秒.

  1. Project builds very very fast. Previously it took around 1 min to build, which has now reduced drastically to 8-10 secs.

对项目的任何更改,尤其是对报告的更改都会更快地保存.

Any changes to the project, especially to reports gets saved much faster.

我曾经得到 "存储空间不足可用于完成此操作" 在一两次构建后.我不得不重新启动 VS 并为每个构建交叉手指.

I used to get "Not enough storage is available to complete this operation" after one or two builds. I had to restart VS and cross my fingers for each of the build.

Crystal Reports 在 CrystalReportViewer 上的显示速度更快,而且 objrpt.PrintToPrinter 的运行速度也提高了 500 倍.

Crystal Reports are displayed faster on CrystalReportViewer and also objrpt.PrintToPrinter works 500 times faster.

我希望这些要点对程序员同行有所帮助.

I hope these points will help fellow programmers.

这篇关于将 DB 日志记录信息应用于每个 Crystal Reports 部分时,应用程序运行缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆