Reputation: 32490
I have some reporting services reports in 2005.
The use a shared data source in a rds file
Ideally I want them to use a connection string that is passed in from a configuration file, ideally via ASP.NETs ReportViewer control.
Is this possible?
Upvotes: 0
Views: 3655
Reputation: 3054
I have accomplished this task by passing in the connectionstring as a Report Parameter and then using the expression to point at the Report Parameter.
This requires the Excecution Account to be set in the SQLRS configuration and that account must be giving appropriate permissions on the database(s) it will be connecting.
Upvotes: 0
Reputation: 6240
You can do it like this:
DataSourceCredentials cred = new DataSourceCredentials();
cred.Name = 'credential_name';
cred.UserId = 'user_id';
cred.Password = 'password';
ReportViewer1.ServerReport.SetDataSourceCredential(new DataSourceCredentials[] { cred });
ReportViewer1.ServerReport.Refresh();
Upvotes: 1
Reputation: 32490
You can set the connection string etc dynamically using expression based connection strings
See http://blogs.msdn.com/bwelcker/archive/2005/04/29/413343.aspx
which uses the the same technique as below
http://msdn.microsoft.com/en-us/library/ms156450.aspx (part about Expression-based Connection Strings)
BUT, this is a bit pants as it means you cant preview your reports in the designer.
Upvotes: 0