my crystal report takes too much time to load data.
The crystal report contain main & 1 subreport.
Below is my vb code.
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
With crConnectionInfo
.IntegratedSecurity = True
End With
CrTables = SSS_Report1.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = NamesComboBox.Text
crParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("AdmissionNo")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
Dim cr1ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr1ParameterFieldDefinition As ParameterFieldDefinition
Dim cr1ParameterValues As New ParameterValues
Dim cr1ParameterDiscreteValue As New ParameterDiscreteValue
cr1ParameterDiscreteValue.Value = ComboBox1.Text
cr1ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr1ParameterFieldDefinition = _
cr1ParameterFieldDefinitions.Item("@Class")
cr1ParameterValues = cr1ParameterFieldDefinition.CurrentValues
cr1ParameterValues.Clear()
cr1ParameterValues.Add(cr1ParameterDiscreteValue)
cr1ParameterFieldDefinition.ApplyCurrentValues(cr1ParameterValues)
Dim cr2ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr2ParameterFieldDefinition As ParameterFieldDefinition
Dim cr2ParameterValues As New ParameterValues
Dim cr2ParameterDiscreteValue As New ParameterDiscreteValue
cr2ParameterDiscreteValue.Value = ComboBox2.Text
cr2ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr2ParameterFieldDefinition = _
cr2ParameterFieldDefinitions.Item("@Session")
cr2ParameterValues = cr2ParameterFieldDefinition.CurrentValues
cr2ParameterValues.Clear()
cr2ParameterValues.Add(cr2ParameterDiscreteValue)
cr2ParameterFieldDefinition.ApplyCurrentValues(cr2ParameterValues)
Dim cr3ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr3ParameterFieldDefinition As ParameterFieldDefinition
Dim cr3ParameterValues As New ParameterValues
Dim cr3ParameterDiscreteValue As New ParameterDiscreteValue
cr3ParameterDiscreteValue.Value = ComboBox3.Text
cr3ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr3ParameterFieldDefinition = _
cr3ParameterFieldDefinitions.Item("@Term")
cr3ParameterValues = cr3ParameterFieldDefinition.CurrentValues
cr3ParameterValues.Clear()
cr3ParameterValues.Add(cr3ParameterDiscreteValue)
cr3ParameterFieldDefinition.ApplyCurrentValues(cr3ParameterValues)
CrystalReportViewer1.ReportSource = SSS_Report1
CrystalReportViewer1.Refresh()
The crystal report contain main & 1 subreport.
Below is my vb code.
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
With crConnectionInfo
.IntegratedSecurity = True
End With
CrTables = SSS_Report1.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = NamesComboBox.Text
crParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("AdmissionNo")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
Dim cr1ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr1ParameterFieldDefinition As ParameterFieldDefinition
Dim cr1ParameterValues As New ParameterValues
Dim cr1ParameterDiscreteValue As New ParameterDiscreteValue
cr1ParameterDiscreteValue.Value = ComboBox1.Text
cr1ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr1ParameterFieldDefinition = _
cr1ParameterFieldDefinitions.Item("@Class")
cr1ParameterValues = cr1ParameterFieldDefinition.CurrentValues
cr1ParameterValues.Clear()
cr1ParameterValues.Add(cr1ParameterDiscreteValue)
cr1ParameterFieldDefinition.ApplyCurrentValues(cr1ParameterValues)
Dim cr2ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr2ParameterFieldDefinition As ParameterFieldDefinition
Dim cr2ParameterValues As New ParameterValues
Dim cr2ParameterDiscreteValue As New ParameterDiscreteValue
cr2ParameterDiscreteValue.Value = ComboBox2.Text
cr2ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr2ParameterFieldDefinition = _
cr2ParameterFieldDefinitions.Item("@Session")
cr2ParameterValues = cr2ParameterFieldDefinition.CurrentValues
cr2ParameterValues.Clear()
cr2ParameterValues.Add(cr2ParameterDiscreteValue)
cr2ParameterFieldDefinition.ApplyCurrentValues(cr2ParameterValues)
Dim cr3ParameterFieldDefinitions As ParameterFieldDefinitions
Dim cr3ParameterFieldDefinition As ParameterFieldDefinition
Dim cr3ParameterValues As New ParameterValues
Dim cr3ParameterDiscreteValue As New ParameterDiscreteValue
cr3ParameterDiscreteValue.Value = ComboBox3.Text
cr3ParameterFieldDefinitions = SSS_Report1.DataDefinition.ParameterFields
cr3ParameterFieldDefinition = _
cr3ParameterFieldDefinitions.Item("@Term")
cr3ParameterValues = cr3ParameterFieldDefinition.CurrentValues
cr3ParameterValues.Clear()
cr3ParameterValues.Add(cr3ParameterDiscreteValue)
cr3ParameterFieldDefinition.ApplyCurrentValues(cr3ParameterValues)
CrystalReportViewer1.ReportSource = SSS_Report1
CrystalReportViewer1.Refresh()