Private rpt As ReportDocument
Protected Sub Page_Load(sender As Object, e As EventArgs)
rpt = New ReportDocument()
rpt.Load(Server.MapPath("../Rpt/myReport.rpt"))
Dim db = UtilityClass.GetDatabaseConnection()
rpt.SetDatabaseLogon(db.UID, db.UPWD, db.HOST, db.DBNAME)
rpt.SetParameterValue("XXXX", YYYYY)
Me.rptCrystal.ReportSource = rpt
rptCrystal.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX
End Sub
Protected Overrides Sub OnUnload(e As EventArgs)
MyBase.OnUnload(e)
Try
If rpt IsNot Nothing Then
rpt.Close()
rpt.Dispose()
GC.Collect()
End If
Catch ex As Exception
End Try
End Sub