I am using an ASP.Net and C# front end to run some reports. I want to open an SQL Connection to the data source used by the report.
When the report uses integrated security it is easy enough to create a connection, however I want to create a connection when the user name and password are stored by the reporting server.
I can get SQL Server path and initial catalogue, using
DataSource[] dataSources;
DataSourceReference dsReference;
DataSourceDefinition dsDefinition;
string dsPath;
ReportingService2005 rs = new ReportingService2005();
dataSources = rs.GetItemDataSources(reportPath);
if (dataSources.Length > 0)
{
dsReference = (DataSourceReference)dataSources[0].Item;
dsPath = dsReference.Reference;
dsDefinition = rs.GetDataSourceContents(dsPath);
// ....
}
I can also get the user name using
username = dsDefinition.UserName;
however if I use
password = dsDefinition.Password;
password = null, and can't be used to open the Sql Connection.
Is there a way to create an SQLConnection that uses the connection string and username and password credentials of a data source?
I am using Reporting Services 2008, and .NET 3.5 with web references to ReportService2005.asmx and ReportExecution2005.asmx