Hi to all,
Well, I am working on dotnet 2005 with crystal reports 10 and backend
as sql server.
I am facing a problem while loading a report.
Actually the issue is, when I load report it takes huge time to load a
report whether it is a 1 page report or thousands page report.
We have migrated the project from VB to VB.NET, in VB its working fine
because in that report is loaded page by page but in VB.NET whole
report is loaded in one go.
I want to improve the performance and want that the report should be
loaded fast in few seconds.
I have used one function which is loading the report every time for
every form.
I am attaching here the function also.
If anyone can provide me with the solution.
Thanks in advance
Here is the function.
Public Sub InitReportLogInfo(ByVal strReportFileNm As String, Optional
ByVal strParameter As String = "")
flag = True
Dim LogOnInfo As New TableLogOnInfo()
Dim strFile As String
Dim intCounter As Integer
Dim strParValPair() As String
Dim index As Integer
Dim mrdocls As New ClsResultSetDB
Dim strsql As String
Dim paraValue As New
CrystalDecisions.Shared.ParameterDiscreteValue 'Parameter value object
of crystal report parameters used for adding the value to parameter.
'Dim strVal() As String
'Dim currValue As
CrystalDecisions.Shared.ParameterValues 'Current parameter
value object(collection) of crystal report parameters.
'Dim mySubReportObject As
CrystalDecisions.CrystalReports.Engine.SubreportOb ject 'Sub
report object of crystal report.
Dim mySubRepDoc As New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent 'Sub
report document of crystal report.
Try
strFile = mP_strReportLocation & strReportFileNm & ".rpt"
mP_strReportFileName = strReportFileNm
If IsNothing(mP_ObjCrystalReport) = True Then
mP_ObjCrystalReport = New ReportDocument
End If
mP_ObjCrystalReport.Load(strFile)
''Code Added By STS as on 23-
Feb-2007============================
If strReportFileNm <"rpt_loc_stk01500" And
strReportFileNm <"rpt_loc_SPL00700" Then
mP_ObjCrystalReport.Refresh()
End If
''Code Ends
Here============================================== ====
intCounter =
mP_ObjCrystalReport.DataDefinition.ParameterFields .Count 'Check if
there are parameters or not in report.
'As parameter fields collection also picks the selection
formula which is not the parametermeter, so if total parameter count
is 1 then we check whether, its a parameter or selection formula.
If intCounter = 1 Then
If
InStr(mP_ObjCrystalReport.DataDefinition.Parameter Fields(0).ParameterFieldName,
".", CompareMethod.Text) 0 Then
intCounter = 0
End If
End If
'If there are parameters in report and user has passed
them then split the
'parameter string and Apply the values, to there concurent
parameters.
If UCase(mP_strReportFileName) = "RPT_BOM00900" Then
If intCounter 0 And Trim(strParameter) <"" Then
strParValPair = strParameter.Split("&")
For index = 0 To UBound(strParValPair)
paraValue.Value = strParValPair(index)
mP_ObjCrystalReport.SetParameterValue(index,
paraValue.Value)
Next
End If
End If
With mP_ObjCrystalReport.DataDefinition.FormulaFields
.Item("Page").Text = "'" & GetLabelDes(83) & "'"
.Item("Date").Text = "'" & GetLabelDes(84) & "'"
.Item("Time").Text = "'" & GetLabelDes(85) & "'"
If Not IsNothing(mP_LocfrmRep.UdcViewPrint1.FormName)
Then
If mP_LocfrmRep.UdcViewPrint1.FormName.ToString()
= "frmCPS00500" Then
strsql = "select [function],Process_flg from
functionctl where [Function]='TPS'"
If Not mrdocls.GetResult(strsql,
AppFunctionModule.mP_EnmResultType.IrdOpenKeyset,
AppFunctionModule.mP_EnmLockType.IrdConcurLock) Then Exit Sub
If mrdocls.GetValue("process_flg") = "1" Then
.Item("TPS").Text = "'" &
GetLabelDes(1362) & "'"
Else
.Item("TPS").Text = "' '"
End If
End If
End If
''Code Ends Here
End With
Call SetReport(LogOnInfo, mP_ObjCrystalReport,
strReportFileNm)
Catch ex As Exception
MsgBox(ex.Message)
flag = False
End Try
End Sub
Waiting for the positive reply ASAP.