vb升级到vb.net后出错

发布于 2024-11-15 20:39:37 字数 1523 浏览 3 评论 0原文

我使用 Visual Basic 将我的项目升级到 vb.net。运行水晶报告时出现错误。

    Call ReportConnection(CInspAuditList, "A")
    CInspAuditList.ReportFileName = My.Application.Info.DirectoryPath & "\A.rpt"
    Call SubReportConnection(CInspAuditList, "A")
    CInspAuditList.set_ParameterFields(0, temp1)
    CInspAuditList.set_ParameterFields(1, temp2)
    CInspAuditList.set_ParameterFields(2, temp3)
    CInspAuditList.set_ParameterFields(3, temp4)
    CInspAuditList.Action = 1

我的连接是

Public Function ReportConnection(ByRef CrystalReport1 As Object, ByRef dsnname As String) As Boolean

    Try
        CrystalReport1.Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
    Catch ex As Exception
        MsgBox(ex.ToString)
        End
    End Try
End Function
Public Function SubReportConnection(ByRef CrystalReport1 As Object, ByRef dsnname As String) As Object
    Dim NReport As Short
    With CrystalReport1
        NReport = .GetNSubreports
        Do While NReport > 0
            .SubreportToChange = .GetNthSubreportName(NReport - 1)
            .Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
            .SubreportToChange = ""
            NReport = NReport - 1
        Loop
    End With
End Function

处收到错误 Exception from HRESULT: 0x800A501B

我在 CInspAuditList.Action = 1 我可以知道如何修复错误吗???

i upgrade my project to vb.net by using visual basic. i get a error when run the crystal report.

    Call ReportConnection(CInspAuditList, "A")
    CInspAuditList.ReportFileName = My.Application.Info.DirectoryPath & "\A.rpt"
    Call SubReportConnection(CInspAuditList, "A")
    CInspAuditList.set_ParameterFields(0, temp1)
    CInspAuditList.set_ParameterFields(1, temp2)
    CInspAuditList.set_ParameterFields(2, temp3)
    CInspAuditList.set_ParameterFields(3, temp4)
    CInspAuditList.Action = 1

my connection is

Public Function ReportConnection(ByRef CrystalReport1 As Object, ByRef dsnname As String) As Boolean

    Try
        CrystalReport1.Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
    Catch ex As Exception
        MsgBox(ex.ToString)
        End
    End Try
End Function
Public Function SubReportConnection(ByRef CrystalReport1 As Object, ByRef dsnname As String) As Object
    Dim NReport As Short
    With CrystalReport1
        NReport = .GetNSubreports
        Do While NReport > 0
            .SubreportToChange = .GetNthSubreportName(NReport - 1)
            .Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
            .SubreportToChange = ""
            NReport = NReport - 1
        Loop
    End With
End Function

i get error Exception from HRESULT: 0x800A501B at CInspAuditList.Action = 1


may i know how to fix the error???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文