joe joe - 1 year ago 124 Question .VerifyDatabase for Crystal Reports using a password restricted Access DB

As the question title suggests, my project that uses Crystal Reports 9 and a password restricted MS-Access 97 database.

When loading reports, the

method calls
which has previously been working fine without a password, but since adding one, it isn't working, and gives me the following error

Log on failed.
at CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()

What do I need to add/change to this code for it to log on successfully?

Private Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load

setFormSizes(Me, con)
Me.Location = New Point((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2), 10)
Me.Text = "Report Viewer - (" & Replace(cReport.FileName, "rassdk://", "") & ")"


crViewer.ReportSource = cReport
crViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None

Catch ex As Exception

End Try
End Sub


The data can be viewed when opening the report file in Crystal Reports itself, but this is because I can manually enter the password.

Answer Source

As per MSDN

 Dim logOnInfo As New TableLogOnInfo()
        Dim i As Integer

        For i = 0 To cReport.Database.Tables.Count - 1
            logOnInfo.ConnectionInfo.DatabaseName = "Database_Name"
            logOnInfo.ConnectionInfo.Password = "Password"
        Next i
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download