Crystal not closing sql database connections
From: LouV (louvig2_at_att.net)
Date: 11/30/04
- Next message: ksedran: "Crystal & ADO.NET Bug?"
- Previous message: jeff: "how to link to different table to retrieve data according to field value"
- Messages sorted by: [ date ] [ thread ]
Date: 30 Nov 2004 14:05:51 -0800
I am using Crystal report to export data from an asp.net page. It
works perfectly. But the connection is not closed and a new
connection is created every time the report is run. This is a
reported issue on Crystal's site and a knowledgebase indicated that
garbage collection should be forced in the page unload event. Did
that and it does nothing. Does anyone have any ideas how I can close
the OleDb connection?
Public crReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim crColParameters As ParameterFieldDefinitions
Dim crColParameter As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim crParameterDiscreteValues As ParameterDiscreteValue = New
ParameterDiscreteValue
Dim crDestOptions As DiskFileDestinationOptions
Dim crExportOptions As New ExportOptions
Dim fname As String
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crLogon As CrystalDecisions.Shared.TableLogOnInfo
crReport.Load("c:\inetpub\wwwroot\billingprojections\Reports\ByClient.rpt")
For Each crTable In crReport.Database.Tables
crLogon = crTable.LogOnInfo
crLogon.ConnectionInfo.UserID = "aaa"
crLogon.ConnectionInfo.Password = "bbb"
crTable.ApplyLogOnInfo(crLogon)
Next crTable
(This portion of code omitted for brevity. It works. It
exports the report to a PDF file)
crReport.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(fname)
End Sub
Private Sub Page_Unload(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Unload
crReport.Close()
crReport.Dispose()
GC.Collect()
End Sub
- Next message: ksedran: "Crystal & ADO.NET Bug?"
- Previous message: jeff: "how to link to different table to retrieve data according to field value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|