From: Sergey Poberezovskiy on
Hi,

I have configured my shared datasource to prompt for credentials, as I do
not want to store username/password information within the source, but want
to set it from within the calling application instead.

Inside my ASP.Net (05) application, I create an instance to the Reporting
Services and set the UID/PWD according to the application connection values:

WebReports.ReportExecutionService srv = new
WebReports.ReportExecutionService();
srv.ExecutionHeaderValue = new WebReports.ExecutionHeader();
WebReports.ExecutionInfo info = srv.LoadReport(reportName, null);
// create datasource credentials:
WebReports.DataSourceCredentials cr = new WebReports.DataSourceCredentials();
cr.DataSourceName = "my_source";
cr.UserName = myUserName;
cr.Password = myPassword;
// now set the database credentials to the service:
srv.SetExecutionCredentials(new WebReports.DataSourceCredentials[] { cr });

And this is the line on which I get the following exception:

Microsoft.ReportingServices.Diagnostics.Utilities.DataSourceNoPromptException:
An attempt was made to set credentials for a data source 'my_source'
associated with the report. Report data source settings are specified in a
way that prevents credentials from being submitted to the report server.
at
Microsoft.ReportingServices.DataExtensions.RuntimeDataSourceInfoCollection.SetCredentials(DatasourceCredentials credentials)

I have tried to search on the exception, but the only link I could find any
answers.

Any help in how to set up the execution credentials programmatically is
greatly appreciated.