R
Ray
Dear all,
By using the following code, I can change the database name of the
crystal report
....
Dim ReportTemp As New ReportDocument
ReportTemp.Load(_report)
For Each table In ReportTemp.Database.Tables
pPrintSetting.OriDataBase = table.Location
pPrintSetting.GetInfo()
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = pPrintSetting.ServerName
.DatabaseName = pPrintSetting.DatabaseName
.UserID = pPrintSetting.UserID
.Password = pPrintSetting.Password
End With
table.ApplyLogOnInfo(logoninfo)
table.Location = String.Concat(pPrintSetting.DatabaseName,
".dbo.", table.Location.Substring(table.Location.LastIndexOf(".") + 1))
Next table
ReportTemp.RecordSelectionFormula = _select
....
However, if there is a subreport in the report, the subreport's database
name cannot be changed, is it possible to change the database name of the
subreport?
Thanks a lot,
Ray
By using the following code, I can change the database name of the
crystal report
....
Dim ReportTemp As New ReportDocument
ReportTemp.Load(_report)
For Each table In ReportTemp.Database.Tables
pPrintSetting.OriDataBase = table.Location
pPrintSetting.GetInfo()
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = pPrintSetting.ServerName
.DatabaseName = pPrintSetting.DatabaseName
.UserID = pPrintSetting.UserID
.Password = pPrintSetting.Password
End With
table.ApplyLogOnInfo(logoninfo)
table.Location = String.Concat(pPrintSetting.DatabaseName,
".dbo.", table.Location.Substring(table.Location.LastIndexOf(".") + 1))
Next table
ReportTemp.RecordSelectionFormula = _select
....
However, if there is a subreport in the report, the subreport's database
name cannot be changed, is it possible to change the database name of the
subreport?
Thanks a lot,
Ray