Private Sub RecurseAndRemap(ByVal CR As Engine.ReportDocument)
For Each DSC As CrystalDecisions.Shared.IConnectionInfo In CR.DataSourceConnections
DSC.SetLogon("YourUserName", "YourPassword")
DSC.SetConnection("YouServerName", "YourDatabaseName", False)
Next
CR.SetDatabaseLogon("YourUserName", "YourPassword")
For Each Table As Engine.Table In CR.Database.Tables
Table.LogOnInfo.ConnectionInfo.UserID = "YourUserName"
Table.LogOnInfo.ConnectionInfo.Password = "YourPassword"
Next
If Not CR.IsSubreport Then
For Each SR As Engine.ReportDocument In CR.Subreports
RecurseAndRemap(SR)
Next
End If
End Sub
这是将更新的服务器保存在实际的Crystal Report中还是保存在内存中的ReportDocument对象中? –
只是在内存中。你是否需要将更新的服务器保存在Crystal报告中,还是只希望在运行时更改连接? – Asif
@AsifGhafoor我想将更新的服务器保存在水晶报表中。这是我的实际问题。 – hims056