【问题标题】:Crystal report load problem on client machine客户端机器上的水晶报表加载问题
【发布时间】:2011-07-23 12:11:55
【问题描述】:
我在 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)
【问题讨论】:
标签:
vb.net
deployment
crystal-reports
crystal-reports-2008
【解决方案1】:
客户端计算机上的数据库名称是否不同?如果是这样,您可能需要在代码中换出表名(也包含数据库名称),以便它们不包含您的数据库名称:
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