我已经在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)
答案 0 :(得分:0)
客户端计算机上的数据库名称是否不同?如果是这样,您可能需要在代码中交换表名(也包含数据库名),因此它们不包含您的数据库名称:
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