Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2895

Re: Re-prompted for database login

$
0
0

Hi Don

My report doesn't have any stored data. It also does not validate database of first refresh. FYI, I'm using VS2010 and SQLOLEDB as a provider. I'm using the following code to change the logon;

 

Public Sub ChangeDBLocationWholeReport(ByRef objReport As ReportDocument, dbConn As DatabaseConnection)

        Dim crConnectionInfo As New ConnectionInfo()

 

 

        crConnectionInfo.ServerName = dbConn.SeverName

        crConnectionInfo.DatabaseName = dbConn.Database

        crConnectionInfo.UserID = dbConn.UserID

        crConnectionInfo.Password = dbConn.Password

 

 

        ChangeDBLocation(objReport, crConnectionInfo)

        For Each subreport As ReportDocument In objReport.Subreports

            ChangeDBLocation(subreport, crConnectionInfo)

        Next

        crConnectionInfo = Nothing

    End Sub

 

 

 

    Private Sub ChangeDBLocation(ByRef objReport As ReportDocument, crConnectionInfo As ConnectionInfo)

        Dim crTables As Tables

        Dim crTableLogonInfo As New TableLogOnInfo()

 

 

        ' Each table in report needs to have logoninfo setup:

        crTables = objReport.Database.Tables

        For Each crTable As Table In crTables

            ' Now make sure we have correct location for sublots table

            crTableLogonInfo = crTable.LogOnInfo

            crTableLogonInfo.ConnectionInfo = crConnectionInfo

            crTable.ApplyLogOnInfo(crTableLogonInfo)

        Next

        'This removes the schema from the Database Table's Location property.

        For Each crTable In objReport.Database.Tables

            Try

                crTable.Location = crTable.Name

            Catch

            End Try

        Next

 

 

        crTables = Nothing

        crTableLogonInfo = Nothing

    End Sub


Viewing all articles
Browse latest Browse all 2895

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>