Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This time, I have encountered a very weird scenario in my Crystal Reports.

Whenever it loads into the screen it says "Login Failed. Please Try Again" Dialog then after clicking OK, I refreshed the Crystal Report Viewer then suddenly it shows me the viewed output of my crystal report.

I tried printing and it worked and the display is updated as to when the database is updated.

The problems here is how to take out that "Login Failed. Please Try Again" Dialog and to let my crystal reports viewer show the viewed output without refreshing it manually.

(Questioner's Note: I have tried commenting out the whole 'With crConnectionInfo' and it loaded just as I wanted too but I know for sure if I were to remove those my crystal report will not work upon deployment.)


For a better insight here is my code:
Dim crReport As New ReportDocument
        Dim crDatabase As Database
        Dim crTableLoginfo As New TableLogOnInfo()
        Dim crConnectionInfo As New ConnectionInfo()
        Dim crTables As Tables

        Try

            crReport.Load(My.Application.Info.DirectoryPath.ToString() & "\PrintAll.rpt")
            With crConnectionInfo
                .ServerName = My.Application.Info.DirectoryPath.ToString() & "\JakeRe.accdb"
                .DatabaseName = "JakeRe.accdb"
                .UserID = "admin"
                .Password = "password"
                .IntegratedSecurity = True
            End With
            crDatabase = crReport.Database
            crTables = crDatabase.Tables
            For Each crTable As Table In crTables
                crTableLoginfo = crTable.LogOnInfo
                crTableLoginfo.ConnectionInfo = crConnectionInfo
                crTable.ApplyLogOnInfo(crTableLoginfo)

            Next
            CrystalReportViewer1.ReportSource = crReport
            CrystalReportViewer1.Refresh()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Error Found!")
        End Try
Posted
Updated 31-Aug-15 22:09pm
v2
Comments
evry1falls 25-May-20 1:48am    
Did you find a solution ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900