Hi, I have created a couple of .rss scripts that uploads reports, creates folders, etc. to my Sql Server 2005 Reporting Services but now I am in need of two new .rss scripts, one that set the Data Source property of a Model and one that sets the Data Source
property of a report (it should point to the model). I can't get those two scripts to work, does anyone know how to accomplish this? Cheers!
Try to use the following vb script to set the datasource to your report.
Public Sub CreateSampleDataSource(name As String, extension As String, connectionString As String)
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = connectionString
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = extension
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
diod
Member
33 Points
17 Posts
How to programmatically set the data source and model?
Apr 22, 2008 03:33 AM|LINK
Nai-Dong Jin...
All-Star
41630 Points
3558 Posts
Re: How to programmatically set the data source and model?
Apr 24, 2008 05:19 AM|LINK
Hi,
Try to use the following vb script to set the datasource to your report.
Public Sub CreateSampleDataSource(name As String, extension As String, connectionString As String)
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = connectionString
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = extension
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(name, parentPath, False, definition, Nothing)
Console.WriteLine("Data source {0} created successfully", name)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
Call the function:
CreateSampleDataSource("AdventureWorks", "SQL", "data source=(local);initial catalog=AdventureWorks")
CreateSampleDataSource("AdventureWorksDW", "OLEDB-MD", "data source=localhost;initial catalog=Adventure Works DW")
Thanks.
diod
Member
33 Points
17 Posts
Re: How to programmatically set the data source and model?
Apr 25, 2008 10:54 AM|LINK
Thanks for your reply, It now works as it should.
Would you also know how to assign System Roles to a user
using rss scripts?