"how to get the data source information from a ssrs report, using .net" Code Answer

2

you can use the reportingservice2005 api to get the datasource used by a particular report.

you need the full path of the report (which i assume you have), and then use it to query the reporting service for its data source (api).

// rs = reportingservice2005 that you need to set up.

datasource ds;
datasources datasources = rs.getitemdatasources(item);

// item is a string containing the full path to the report.

datasources = rs.getitemdatasources(item);
ds = datasources[0];

the ds in the code above is either a datasourcedefinition or a datasourcereference. if it's a definition you can just cast it into that type and then get the connection string using the following code.

datasourcedefinition dsd = ds as datasourcedefinition();
if(dsd == null)
    throw new exception();

string connectionstring = dsd.connectstring;

if it's a datasourcereference you need to check out the api.

By Jason Baker on August 14 2022

Answers related to “how to get the data source information from a ssrs report, using .net”

Only authorized users can answer the Search term. Please sign in first, or register a free account.