首页 文章

无法打开连接[Crystal Report]

提问于
浏览
1

我加载使用Crystal Report的表单时收到此错误:

无法打开连接详细信息:[数据库供应商代码:17]无法打开连接 . ReportMonthly . rpt详细信息:[数据库供应商代码:17]

我已经在google上研究了这个错误,所以我找到了这个 site . 我尝试了那里的步骤或说明,但它不起作用意味着相同的错误 .

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 回答

  • 1

    创建连接手册

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

相关问题