Crystal not closing sql database connections

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: LouV (louvig2_at_att.net)
Date: 11/30/04


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



Relevant Pages

  • Re: Frustration and Excitement with Crystal Reports
    ... data in it to report on. ... 'you may have to fool with the right hand side to get the right connection - ... Right click on the Database Fields. ... Select "Set Datasource Location". ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Am I attacked ?
    ... found no logic) TCP ports, to various ports, and it wasn't blocked!?! ... What should I do about that belgium intrusion (report? ... "Zebedee" a écrit dans le message de ... > blocked those connection attempts:) ...
    (comp.security.firewalls)
  • Re: Virgin Media team up with SamKnows to see who is best? Virgin media come out tops!!
    ... My observation last year of the 20Mb/s line last year was that congestion in peak times regularly slowed the per connection speed to between 1-2Mb/s. ... This was a good report, I believe it was after this report that interested parties, such as VM, started funding Samknows. ... However much of my internet usage involved single thread operations such as video streaming and this meant the the VM line significantly under performed a 4Mb/s DSL line. ... So given that and comparing it to those mealy mouthed "up to" speeds ...
    (uk.telecom.broadband)
  • Jimmie quits knitting
    ... Shah, in connection with bottoms disappointed and elderly, gasps ... then report at last the question alongside the farm. ... Taysseer, have a overseas cinema. ... appreciate architectural desires to fortunately suffer. ...
    (sci.crypt)
  • Re: Wifi indicator LED - update
    ... Then I lost the connection. ... something turns wifi off and it can't be turned back one. ... No, the router is 24/7, and gets a reboot maybe 6 times/year. ... If I find any evidence to even suggest a likely explanation I'll report ...
    (Fedora)