Hello,
Using following vb.net code i can change database location without problems:
*******************************************************************
Public Class Form1
Dim boReportDocument As New DDT_Template
Public Function ChangeConnectionInfo() As ReportDocument
Dim boTable As New CrystalDecisions.ReportAppServer.DataDefModel.Table
Dim boMainPropertyBag As New PropertyBag
Dim boInnerPropertyBag As New PropertyBag
CrystalReportViewer1.ReportSource = boReportDocument
With boInnerPropertyBag
.Add("Data Source", CR_Connection_String)
.Add("Database Type", "Access")
.Add("Locale Identifier", "1033")
.Add("OLE DB Services", "-6")
.Add("Provider", "Microsoft.Jet.OLEDB.4.0")
.Add("Use DSN Default Properties", "False")
End With
With boMainPropertyBag
.Add("Database DLL", "crdb_ado.dll")
.Add("QE_DatabaseName", "")
.Add("QE_DatabaseType", "OLE DB (ADO)")
.Add("QE_LogonProperties", boInnerPropertyBag)
.Add("QE_ServerDescription", CR_Connection_String)
.Add("QE_SQLDB", "True")
.Add("SSO Enabled", "False")
End With
Dim boConnectionInfo As New CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo
With boConnectionInfo
.Attributes = boMainPropertyBag
.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE
.UserName = ""
.Password = ""
End With
boTable.ConnectionInfo = boConnectionInfo
Dim boTables As CrystalDecisions.ReportAppServer.DataDefModel.Tables = _
boReportDocument.ReportClientDocument.DatabaseController.Database.Tables
For Each boReportTable In boTables
With boTable
.Name = boReportTable.Name
.QualifiedName = boReportTable.Name 'boReportTable.QualifiedName
.Alias = boReportTable.Alias
End With
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boReportTable, boTable)
Next
boReportDocument.VerifyDatabase()
boReportDocument.SetParameterValue("ID_Testata", 7)
Return boReportDocument
End Function
end class
*******************************************************************
After i added to DDT_Template a subreport, database logon info prompt for subreport.
How i can modify vb.net code to modify subreport database connection too?
Thanks for support