Function BindReportConnectionInfo(ByVal reportDoc As ReportDocument)
Dim crConnectionInfo = New ConnectionInfo()
Dim csb As New Data.SqlClient.SqlConnectionStringBuilder(sqlConStr())
If True Then
crConnectionInfo.ServerName = csb.DataSource
crConnectionInfo.DatabaseName = csb.InitialCatalog
'crConnectionInfo.UserID = csb.UserID
'crConnectionInfo.Password = csb.Password
crConnectionInfo.integratedSecurity = True
End If
'Loop through all tables in the report and apply the connection
'information for each table.
For Each crTable As Table In reportDoc.Database.Tables
crTable.LogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
For Each sr As ReportDocument In reportDoc.Subreports
For Each crTable As Table In sr.Database.Tables
crTable.LogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
Next
End Function
Dim crConnectionInfo = New ConnectionInfo()
Dim csb As New Data.SqlClient.SqlConnectionStringBuilder(sqlConStr())
If True Then
crConnectionInfo.ServerName = csb.DataSource
crConnectionInfo.DatabaseName = csb.InitialCatalog
'crConnectionInfo.UserID = csb.UserID
'crConnectionInfo.Password = csb.Password
crConnectionInfo.integratedSecurity = True
End If
'Loop through all tables in the report and apply the connection
'information for each table.
For Each crTable As Table In reportDoc.Database.Tables
crTable.LogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
For Each sr As ReportDocument In reportDoc.Subreports
For Each crTable As Table In sr.Database.Tables
crTable.LogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTable.LogOnInfo)
Next
Next
End Function
No comments:
Post a Comment