客户端机器上的水晶报表加载问题

发布于 2024-11-26 00:48:16 字数 364 浏览 2 评论 0原文

我在 vb.net 2008 上开发了一个 Windows 应用程序,并将其部署在客户端计算机上,我的水晶报告通过 DSN 配置为服务器,在我的开发计算机上一切正常,但在客户端计算机上生成的是“加载报告失败”。我已通过文件系统在安装包中添加了 Reports 文件夹以及该文件夹中的所有 RPT 文件。

Dim path As String
path = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10)
Dim fullpath As String = path & "\Reports\slip.rpt "
cryRpt.Load(fullpath) 

I have developed a windows application on vb.net 2008 and deployed it on client machine my crystal reports are configured through DSN to server everything is going fine om my development machine but on client machine producing is "Load Report failed" . I have added Reports folders and all RPT files in that folder in installation package through file system.

Dim path As String
path = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10)
Dim fullpath As String = path & "\Reports\slip.rpt "
cryRpt.Load(fullpath) 

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱娆 2024-12-03 00:48:16

客户端计算机上的数据库名称是否不同?如果是这样,您可能需要在代码中交换表名(也包含数据库名称),以便它们不包含您的数据库名称:

    Dim logOnInfo As New TableLogOnInfo
    With logOnInfo.ConnectionInfo
        .ServerName = myConString.ServerName
        .DatabaseName = myConString.DatabaseName
        .UserID = myConString.UserName
        .Password = myConString.Password
    End With

    ' Loop through every table in the report.
    For Each Table As Table In cReport.Database.Tables

        ' Apply the new connecion information
        Table.ApplyLogOnInfo(logOnInfo)

        ' Repoint each table to the new database (by cutting the old database name off the front)
        Table.Location = myTable.Location.Substring(Table.Location.LastIndexOf(".") + 1)
    Next

Is the Database name different on the client machine? If so you might need to swap out the tablenames (which also contain the database name) in code so they don't contain your database name:

    Dim logOnInfo As New TableLogOnInfo
    With logOnInfo.ConnectionInfo
        .ServerName = myConString.ServerName
        .DatabaseName = myConString.DatabaseName
        .UserID = myConString.UserName
        .Password = myConString.Password
    End With

    ' Loop through every table in the report.
    For Each Table As Table In cReport.Database.Tables

        ' Apply the new connecion information
        Table.ApplyLogOnInfo(logOnInfo)

        ' Repoint each table to the new database (by cutting the old database name off the front)
        Table.Location = myTable.Location.Substring(Table.Location.LastIndexOf(".") + 1)
    Next
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文