目前我使用下面的方法来分配连接信息到所有的报表节。但正如我在报告中许多部分,大约10秒后显示报告。这看起来很慢。是存在的,使我们可以在它被安装在客户端设置登录信息到每个CR一劳永逸某种其它方法。
JFYI :所有的CR连接到同一个数据库,具有相同的登录凭据。谢谢你在前进。
readDiamondBillReport =新RealDiamondBill();
crConnectionInfo.ServerName = db.Connection.DataSource;
crConnectionInfo.DatabaseName = db.Connection.Database;
crConnectionInfo.UserID =客户;
crConnectionInfo.Password =客户;
crConnectionInfo.IntegratedSecurity = FALSE;
CrTables = readDiamondBillReport.Database.Tables;
的foreach(CrystalDecisions.CrystalReports.Engine.Table CrTable在CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
第crSections2 = readDiamondBillReport.ReportDefinition.Sections;
//通过所有的节环找到所有的报表对象
的foreach(在crSections2节crSection)
{
ReportObjects crReportObjects = crSection.ReportObjects;
//通过在那里的所有报表对象循环查找所有子报表
的foreach(ReportObject crReportObject在crReportObjects)
{
如果(crReportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject crSubreportObject =(SubreportObject)crReportObject;
//打开报表对象和登录作为一般的报告
的ReportDocument crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
表SubCrTables = crSubreportDocument.Database.Tables;
的foreach(CrystalDecisions.CrystalReports.Engine.Table SubCrTable在SubCrTables)
{
crtableLogoninfo = SubCrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
SubCrTable.ApplyLogOnInfo(crtableLogoninfo);
}
}
}
}
readDiamondBillReport.Refresh();
解决方案
我终于发现,无论是应用的登录信息是问题,也刷新该报告。但它是我用的水晶报表设置水印我的大图片对象。
我有10个报告,其中用这个图片作为水印。我删除了水印的图像,现在下面的问题都解决了:
项目建立非常非常快。 previously花了约1分钟打造,现已大幅减少到8-10秒。
任何更改的项目,特别是报告会保存得更快。
我用得到"Not存储空间不足后的一个或两个版本来完成此操作。我不得不重新启动VS,穿过我的手指为每个版本的。
水晶报表显示更快的CrystalReportViewer也 objrpt.PrintToPrinter
作品500倍的速度。
我希望这几点将有助于同胞的程序员。
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: 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.
I had 10 reports which used this Image as watermark. I removed the watermarked image and now following problems are solved:
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.
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 are displayed faster on CrystalReportViewer and also objrpt.PrintToPrinter
works 500 times faster.
I hope these points will help fellow programmers.
上一篇:如何获得国家(或它的ISO code)?它的、如何获得、国家、code
下一篇:连接到数字秤(Metler托莱多PS90)作为HID运行OnReport只有当电缆连接到计算机的第一次连接到、电缆、数字、计算机