Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Crystal Ask for Login Post Reply Post New Topic
Author Message
Hugo
Newbie
Newbie


Joined: 05 Aug 2010
Location: Canada
Online Status: Offline
Posts: 8
Quote Hugo Replybullet Topic: Crystal Ask for Login
    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


Edited by Hugo - 05 Aug 2010 at 4:09am
IP IP Logged
Hugo
Newbie
Newbie


Joined: 05 Aug 2010
Location: Canada
Online Status: Offline
Posts: 8
Quote Hugo Replybullet Posted: 06 Aug 2010 at 2:33am
Any one?
IP IP Logged
Hugo
Newbie
Newbie


Joined: 05 Aug 2010
Location: Canada
Online Status: Offline
Posts: 8
Quote Hugo Replybullet 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 ...
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.