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