我的Crystal Report在运行时速度很慢,我使用VB.NET帮助.. [英] My Crystal Report is so slow in runtime I use VB.NET help..
问题描述
这里是代码
Dim CR As 新 ReportDocument
CR.Load(Application.StartupPath + \IDcr.rpt)
'
' 声明与参数相关的对象。
'
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
'
' 获取报告的参数集合。
DirectCast (CR.ReportDefinition.ReportObjects( < span class =code-string> Text9),TextObject).Text = txtName.Text
DirectCast (CR.ReportDefinition.ReportObjects ( Text11),TextObject).Text = txtAddress.Text
DirectCast (CR.ReportDefinition.ReportObjects( Text12) ,TextObject).Text = txtBarcode.Text
'
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
'
' 设置第一个参数
' - 获取参数,告诉它使用当前值与默认值。
' - 告诉它参数包含1个离散值与多个值。
' - 设置参数的值。
' - 添加并应用它。
' - 为每个参数重复这些语句。
'
crParameterFieldLocation = crParameterFieldDefinitions.Item( MemPic)
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = 新 CrystalDecisions。共享 .ParameterDiscreteValue
crParameterDiscreteValue.Value = txtSID.Text
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
'
' 设置Crytal报告Viewer控件的报告文档源。
'
frmPrintID .CrystalReportViewer1.ReportSource = CR
frmPrintID.Show()
我 .Close()
这里有一些关于双方表现的建议
数据库方面
在SQL Server中优化数据访问的十大步骤:第一部分(使用索引) [ ^ ]
优化SQL Server数据访问的十大步骤:第二部分(重新考虑TSQL并应用最佳实践) ) [ ^ ]
在SQL Server中优化数据访问的十大步骤:第三部分(应用高级索引和非规范化) [ ^ ]
在SQL Server中优化数据访问的十大步骤:第四部分(诊断)数据库性能问题) [ ^ ]
在SQL Server中优化数据访问的十大步骤:第五部分(优化数据库文件和应用分区) [ ^ ] < br $> b $ b
水晶报告方
报表分析器:优化Crystal Reports [ ^ ]
优化报告性能 [ ^ ]
优化Crystal Reports [ ^ ]
水晶报告使用.NET C#(SetDataSource)缓慢加载[ ^ ]
希望这些能帮到你。
Heres what happen... I create an app using vb.net that creates ID Card with picture and little details such as ID Picture, Barcode and Name... In my project I use a Windows XP machine... It runs very well... then I start to create a setup file.. I try it first here in my Windows XP so I install it here.. When I open the .exe file and start printing ID Card... It runs smoothly ... Then I deploy it now on a Windows 7 Machine... I install everything needed... the system runs very well... but the opening of the of ID Card form was so slow... it takes almost 5mins to show the ID Card form with crystal report viewer .... I dont know what happen here because there is no wrong with the code... I dont know the reason why it should take a very long time to open it ... I try some tutorials they said that it should run a dummy crystal report viewer so the CRengine will run... I try it but I got the same result.. still slow..
here's the code
Dim CR As New ReportDocument
CR.Load(Application.StartupPath + "\IDcr.rpt")
'
' Declare the parameter related objects.
'
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
'
' Get the report's parameters collection.
DirectCast(CR.ReportDefinition.ReportObjects("Text9"), TextObject).Text = txtName.Text
DirectCast(CR.ReportDefinition.ReportObjects("Text11"), TextObject).Text = txtAddress.Text
DirectCast(CR.ReportDefinition.ReportObjects("Text12"), TextObject).Text = txtBarcode.Text
'
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
'
' Set the first parameter
' - Get the parameter, tell it to use the current values vs default value.
' - Tell it the parameter contains 1 discrete value vs multiple values.
' - Set the parameter's value.
' - Add it and apply it.
' - Repeat these statements for each parameter.
'
crParameterFieldLocation = crParameterFieldDefinitions.Item("MemPic")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = txtSID.Text
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
'
' Set the Crytal Report Viewer control's source to the report document.
'
frmPrintID.CrystalReportViewer1.ReportSource = CR
frmPrintID.Show()
Me.Close()
Here some suggestions regarding the performance on both sides
Database side
Top 10 steps to optimize data access in SQL Server: Part I (use indexing)[^]
Top 10 steps to optimize data access in SQL Server: Part II (Re-factor TSQL and apply best practices)[^]
Top 10 steps to optimize data access in SQL Server: Part III (Apply advanced indexing and denormalization)[^]
Top 10 steps to optimize data access in SQL Server: Part IV (Diagnose database performance problems)[^]
Top 10 steps to optimize data access in SQL Server: Part V (Optimize database files and apply partitioning)[^]
Crystal reports side
Report Analyzer: Optimize Crystal Reports[^]
Optimizing Report Performance[^]
Optimizing Crystal Reports[^]
Crystal Reports Slow Load Using .NET C# ( SetDataSource )[^]
Hope these will help you.
这篇关于我的Crystal Report在运行时速度很慢,我使用VB.NET帮助..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!