all groups > sql server reporting services > december 2005 >
You're in the

sql server reporting services

group:

selecting datasource when redistributing reports


selecting datasource when redistributing reports Craig L
12/30/2005 11:07:51 AM
sql server reporting services:
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

Re: selecting datasource when redistributing reports Potter
12/30/2005 11:11:55 AM
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
------------------------------------------------
AddThis Social Bookmark Button