Crystal Report löst "Verbindung konnte nicht geöffnet werden" aus nur auf postback

Ich habe einen Crystal Reports-Bericht mit der Pull-Methode erstellt, um Daten von SQL Server Express abzurufen. Ich exportiere den Bericht als pdf. Es funktioniert gut, aber nur auf pageLoad. Ich erhalte diese Fehlermeldung, wenn ich versuche, den Bericht in einem Postback zu exportieren.

Failed to open the connection.
Details:  [Database Vendor Code: 4060 ]Failed to open the connection.
CrystalReportPull {2B7D5D2A-C29F-4F27-AFAD-EEAECD909D08}.rpt
Details:  [Database Vendor Code: 4060 ] 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.Runtime.InteropServices.COMException: Failed to open the connection.
Details:  [Database Vendor Code: 4060 ]Failed to open the connection.
CrystalReportPull {2B7D5D2A-C29F-4F27-AFAD-EEAECD909D08}.rpt
Details:  [Database Vendor Code: 4060 ]

Source Error: 

Line 58:                 CrystalTable.ApplyLogOnInfo(logonInfo)
Line 59:             Next
Line 60:             report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "ExportedReport")
Line 61:             report.Dispose()
Line 62:         End If

 Source File:  C:\Users\boruch\Dropbox\Korns-ConnectionStr\reports\CreateReport.aspx.vb    Line:  60 

Stack Trace: 

[COMException (0x800002f4): Failed to open the connection.
Details:  [Database Vendor Code: 4060 ]
Failed to open the connection.
CrystalReportPull {2B7D5D2A-C29F-4F27-AFAD-EEAECD909D08}.rpt
Details:  [Database Vendor Code: 4060 ]]
   CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
   CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +525

[InternalException: Failed to open the connection.
Details:  [Database Vendor Code: 4060 ]
Failed to open the connection.
CrystalReportPull {2B7D5D2A-C29F-4F27-AFAD-EEAECD909D08}.rpt
Details:  [Database Vendor Code: 4060 ]]
   CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +346
   CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +627
   CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +1203
   CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) +150
   CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName) +211
   CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName) +240
   reports_CreateReport.Page_SaveStateComplete(Object sender, EventArgs e) in C:\Users\boruch\Dropbox\Korns-ConnectionStr\reports\CreateReport.aspx.vb:60
   System.Web.UI.Page.OnSaveStateComplete(EventArgs e) +9644490
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1282

Hier ist mein Code in vb.net:

txt_from.Text = Now.Date.AddYears(-1)
        txt_to.Text = Now.Date
        If IsPostBack Then
            Dim report As New ReportDocument()
            report.Load(Server.MapPath("~/reports/CrystalReportPull.rpt"), OpenReportMethod.OpenReportByTempCopy)
            Dim custID As Integer = -1
            If ddl_Customer.SelectedValue <> "" Then
                custID = CInt(ddl_Customer.SelectedValue)

            End If
            report.SetParameterValue(0, txt_from.Text)
            report.SetParameterValue(1, txt_to.Text)
            report.SetParameterValue(2, custID)


            Dim logonInfo As New CrystalDecisions.Shared.TableLogOnInfo()
            Dim CrystalTable As CrystalDecisions.CrystalReports.Engine.Table
            For Each CrystalTable In report.Database.Tables
                logonInfo = CrystalTable.LogOnInfo
                logonInfo.ConnectionInfo.ServerName = "BORUCH-PC\SQLEXPRESS"
                logonInfo.ConnectionInfo.DatabaseName = ""
                logonInfo.ConnectionInfo.UserID = ""
                logonInfo.ConnectionInfo.Password = ""

                CrystalTable.ApplyLogOnInfo(logonInfo)
            Next
            report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "ExportedReport")
            report.Dispose()
        End If

Ich erhalte den gleichen Fehler, wenn ich diesen Code mit einem Klick auf eine Schaltfläche oder sogar in pageload ausführe, wenn ich mich in a einfügeif ispostback Klausel.

Ich habe versucht, diesen Code in Prerender, Init usw. auszuführen, ohne Erfolg.

Crystal Reports Version 13.0, .NET 3.5, SQL Server 2008 Express, VS 2010

Jede Hilfe wäre sehr dankbar.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage