Skip to Content
0
Former Member
Mar 03, 2009 at 11:08 AM

Database Connection fails on some computers

24 Views

Hi.

We've got some problems with .net application and CR viewer.

We use Visual Studio 2005 and CR XI

Connection is established with the same parameters as the application is connecting with the database:

Private Sub ConfigureCrystalReports()
        Dim crConnectionInfo As ConnectionInfo
        Dim crDatabase As Database
        Dim crTables As Tables, crTable As Table
        Dim crLogOnInfo As TableLogOnInfo
        Dim crSections As Sections, crSection As Section
        Dim crReportObjects As ReportObjects, crReportObject As ReportObject
        Dim crSubreportObject As SubreportObject, crSubreport As ReportDocument

        Using cnn1 As New SqlClient.SqlConnection(ConString)
            crConnectionInfo = New ConnectionInfo
            With crConnectionInfo
                .ServerName = cnn1.DataSource
                .DatabaseName = cnn1.Database
                .UserID = "juhi"
                .Password = "********"
            End With
        End Using

        crDatabase = crreport.Database
        crTables = crDatabase.Tables
        For Each crTable In crTables
            crLogOnInfo = crTable.LogOnInfo
            crLogOnInfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crLogOnInfo)
        Next

        crSections = crreport.ReportDefinition.Sections
        For Each crSection In crSections
            crReportObjects = crSection.ReportObjects
            For Each crReportObject In crReportObjects
                If crReportObject.Kind = ReportObjectKind.SubreportObject Then
                    crSubreportObject = CType(crReportObject, SubreportObject)
                    crSubreport = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
                    crDatabase = crSubreport.Database
                    crTables = crDatabase.Tables
                    For Each crTable In crTables
                        crLogOnInfo = crTable.LogOnInfo
                        crLogOnInfo.ConnectionInfo = crConnectionInfo
                        crTable.ApplyLogOnInfo(crLogOnInfo)
                    Next
                End If
            Next
        Next

        CrystalReportViewer1.ReportSource = crreport

    End Sub

On the Clients we have installed CRRedist2005_x86.msi

On some Clients it works perfectly ... on others there is no connection established and after minutes (felt like hours) a login msgbox appears ... with all logon info but the password. But even typing in the correct pw will not establish the connection.