如何获取报表在SQL Server Reporting Services 2005中使用的DataSource

时间:2022-06-17 08:17:32

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.

为了创建正确的查询,我需要能够针对报告使用的相同数据源运行查询。如何以编程方式获取该信息?优选地,连接字符串或用于构建连接字符串的数据片段。

3 个解决方案

#1


1  

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

string connectionString = dataSourceDefinition.ConnectString;

#2


0  

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

如果您拥有正确的权限,则可以访问http:// servername / reports /并查看数据源连接详细信息。

#3


0  

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

如果您正在使用visual studio,请查看数据选项卡。

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.

如果您只能访问SSRS服务器上的报告,则可以导航到报告,单击“属性”选项卡,然后单击左侧的“数据源”选项。

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.

编辑:在添加“编程”之前,此答案适用于最初编写的问题。

#1


1  

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

string connectionString = dataSourceDefinition.ConnectString;

#2


0  

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

如果您拥有正确的权限,则可以访问http:// servername / reports /并查看数据源连接详细信息。

#3


0  

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

如果您正在使用visual studio,请查看数据选项卡。

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.

如果您只能访问SSRS服务器上的报告,则可以导航到报告,单击“属性”选项卡,然后单击左侧的“数据源”选项。

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.

编辑:在添加“编程”之前,此答案适用于最初编写的问题。