简体   繁体   中英

How do you get the DataSource that a report uses in SQL Server Reporting Services 2005

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.

DataSourceDefinition dataSourceDefinition 
    = reportingService.GetDataSourceContents("DataSourceName");

string connectionString = dataSourceDefinition.ConnectString;

如果您拥有正确的特权,则可以转到http:// servername / reports /并从中查看数据源连接详细信息。

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.

EDIT: This answer applied to the question as originally written, before "programmatically" was added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM