Dear SAP TEAM ,
Please help me to solve this queries , I am struggling with below points from last one week . searched lot of forums and blog but I didn’t get a answer ,
And My Query is
I am using VS 2010 and inbuilt sap crystal report version 13 with backend oracle .
Crystal report is loading for each and every action and hitting the database every time , while going to accounts reports we have 15 – 20 page of data’s
When user navigate from 1st page to 2nd page , report against hit the DB .
To avoid this problem , I have handled session in aspx page. So 1st page alone will load and after every action data’s will pull from session , its working fine .
BUT when I start to use session I can’t able to DISPOSE or CLOSE object from TEMP file . I have pasted my code and also attached sample file . please check and update .
When I am navigate to 2 nd page I am getting error “OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT”
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Session("Report") = Nothing
End If
If Session("Report") Is Nothing Then
rpt = New ReportDocument
rpt.Load(Server.MapPath("CrystalReport1.rpt"))
Session.Add("Report", rpt)
rpt.SetParameterValue("Name", "SAP CRYSTAL REPORTS")
CrystalReport.HasToggleParameterPanelButton = False
CrystalReport.ToolPanelView = ToolPanelViewType.None
CrystalReport.ReportSource = CType(Session("Report"), ReportDocument)
Else
rpt = New ReportDocument
CrystalReport.ReportSource = CType(Session("Report"), ReportDocument)
End If
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
If rpt IsNot Nothing Then
rpt.Close()
rpt.Dispose()
End If
End Sub
Protected Sub CrystalRreport_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReport.Unload
If rpt IsNot Nothing Then
rpt.Close()
rpt.Dispose()
End If
End Sub
End Class
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.