Print Page | Close Window

Crystal Ask for Login

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10746
Printed Date: 03 May 2024 at 12:56am


Topic: Crystal Ask for Login
Posted By: Hugo
Subject: Crystal Ask for Login
Date Posted: 05 Aug 2010 at 4:08am
Hi!
I'm having an issues with crystal Report, on witch I cant find a solution. And I need help.

I know this question have allready been ask a thousand time, but I cannot find any solution over the web.

The problem is; At time when My Report is display on the Crystal Report Preview, crystal ask me for the Database Login. but this occur only at on one site and I cannot reproduce the problem on my computer or any other computer.

Here a bit about the environment;
 - The Report is directly connected to the SQL Server engine Database
 - I'm using Crystal Report 2005 (supplied with Visual Studio 20005)
 - This is coded with VB.NET 2005
 - Crystal DLL are all the same on all site.

Before calling the display of the report in the Crystal Raport Preview,
i'm changing the crystal Report database connection using this procedure:

    Private Function SetDatabaseConnectionString(ByVal pRpt As ReportDocument) As ReportDocument

        Dim oSQLConn As New System.Data.SqlClient.SqlConnectionStringBuilder(Informat.Data.CurrentDatabase.Database.ConnectionString.ConnectionString)
        Dim oDBConnInfo As New TableLogOnInfo
        Dim oTableConnInfo As New TableLogOnInfo
        Dim oConnInfo As New ConnectionInfo

        oConnInfo.ServerName = oSQLConn.DataSource
        oConnInfo.DatabaseName = oSQLConn.InitialCatalog
        oConnInfo.IntegratedSecurity = oSQLConn.IntegratedSecurity

        If Not oSQLConn.IntegratedSecurity Then
            oConnInfo.UserID = oSQLConn.UserID
            oConnInfo.Password = oSQLConn.Password
        End If

        pRpt.SetDatabaseLogon(oSQLConn.UserID, oSQLConn.Password, oSQLConn.DataSource, oSQLConn.InitialCatalog, True)


        '******************************************************
        For itbl As Int32 = 0 To pRpt.Database.Tables.Count - 1
            oTableConnInfo = pRpt.Database.Tables(itbl).LogOnInfo
            oTableConnInfo.ConnectionInfo = oConnInfo
            pRpt.Database.Tables(itbl).ApplyLogOnInfo(oTableConnInfo)
        Next itbl
    
        '******************************************************
        ' Maintenant pour tout les SubReport
        ' Noté que un SubReport ne peut pas contenir d'autre SubReport

        For iSubRpt As Int32 = 0 To pRpt.Subreports.Count - 1
            For iSubTbl As Int32 = 0 To pRpt.Subreports(iSubRpt).Database.Tables.Count - 1
                oTableConnInfo = pRpt.Subreports(iSubRpt).Database.Tables(iSubTbl).LogOnInfo
                oTableConnInfo.ConnectionInfo = oConnInfo
                pRpt.Subreports(iSubRpt).Database.Tables(iSubTbl).ApplyLogOnInfo(oTableConnInfo)
            Next iSubTbl
            pRpt.Subreports(iSubRpt).SetDatabaseLogon(oSQLConn.UserID, oSQLConn.Password, oSQLConn.DataSource, oSQLConn.InitialCatalog, True)

        Next iSubRpt

        pRpt.Refresh()

        Return pRpt
    End Function



I've try many diffrent way to change the connection but whatever I try, the report preview ask me for Database identification.

I'm now clue less.
Please help!

Hugo



Replies:
Posted By: Hugo
Date Posted: 06 Aug 2010 at 2:33am
Any one?


Posted By: Hugo
Date Posted: 12 Aug 2010 at 9:42am
God d*m i just found it.

The Report was using "SQL Server Native Client 10.0"
I changed it to "Microsoft OLE BD Provider for SQL Server" and all go nice and smooth...

Finally ...



Print Page | Close Window