1
votes

I'm receiving this error when I load the form that uses Crystal Report:

Failed to open the connection Details: [Database Vendor Code: 17] Failed to open the connection. ReportMonthly {...}.rpt Details: [Database Vendor Code: 17]

I've researched on google about this error and so I find this site. I tried the steps or the instructions there but it didn't work meaning the same error.

Here is the part of the code in my form:

Private Sub FRViolators_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ShowReport(My.Application.Info.DirectoryPath & "\ReportMonthly.rpt")

End Sub


Public Sub ShowReport(ByVal strReportPath As String)
    Dim rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument
    rptDoc = New ReportDocument

    rptDoc.Load(strReportPath)
    CrystalReportViewer1.ReportSource = rptDoc
    CrystalReportViewer1.Refresh()
End Sub
1
Hi Harvey. You are not providing the report with connection details in your code. Presumably you want to use the connection details used in the design of the report. Are the details in the report valid for runtime?Zec
Where is the connection?JulyOrdinary

1 Answers

1
votes

Create the connection manual

rptDoc.Load(strReportPath)
rptDoc.SetDatabaseLogon("user", "password", "host", "dbname");
CrystalReportViewer1.ReportSource = rptDoc
CrystalReportViewer1.Refresh()