Hi,
Thanks to an earlier post, I can distribute report to our client base =),
but I have hit a new snag.
The connection string used to create the report is not the string needed on
the client sites. Is there a way to automagically update the connection
string in a report with the correct info from the server it is being
installed on?
Thanks,
Craig
Potter - 30 Dec 2005 19:11 GMT
Craig,
The report is associated with a datasource. The datasource is where
you'll find the connection string used by a report.
It is possible to programmatically create a datasource. You could
collect the connection string server/db/user/pw in your installer and
then code the creation of the datasource by the report.
---------------------------------------------------------------------------
Public Sub CreateSampleDataSource()
Dim name As String = "AdventureWorks"
Dim parent As String = "/" + parentFolder
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = "data source=(local);initial
catalog=AdventureWorks2000"
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(name, parent, False, definition, Nothing)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
------------------------------------------------