是否有任何方法可以更改报表及其所有子报表的数据源位置,而无需手动打开每个报表?
以下是我在运行时设置连接的方法.我从配置位置获取连接信息.
#'SET REPORT CONNECTION INFO For i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1 rsource.ReportDocument.DataSourceConnections(i).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword) Next For i = 0 To rsource.ReportDocument.Subreports.Count - 1 For x = 0 To rsource.ReportDocument.Subreports(i).DataSourceConnections.Count - 1 rsource.ReportDocument.OpenSubreport(rsource.ReportDocument.Subreports(i).Name).DataSourceConnections(x).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword) Next Next