views:

314

answers:

4

In order to create the proper queries I need to be able to run a query against the same datasource that the report is using. How do I get that information programatically? Preferably the connection string or pieces of data used to build the connection string.

A: 

If you have the right privileges you can can go to http://servername/reports/ and view the data source connection details through there.

Erikk Ross
A: 

If you're using visual studio just look at the data tab.

If you just have access to the report on the SSRS server you can navigate to the report, click the Properties tab, then the Data Sources option on the left.

If it's a custom data source you can get the connection info from there.

If it's shared, you'll need to navigate to the data source path shown, and can get the connection info from there.

EDIT: Also, if you just have the report file itself you should be able to open it in notepad and find the data source information inside. Unless it uses a shared data source I guess... in which case you'll need to find that.

Telos
+1  A: 
DataSourceDefinition dataSourceDefinition 
    = reportingService.GetDataSourceContents("DataSourceName");

string connectionString = dataSourceDefinition.ConnectString;
Orion Adrian
A: 

u can use shared datasource or solution datasource

balaweblog