How to get DataSource from a DataSourceReference?
Hi Folks,
I have a report that contains a data source reference called 'dsSomeSource' and there is a shared data source called Bob that is pointed to by the data source reference in the report.
Does anyone know how [programatically] I can get the data source [Bob] via the data source reference [dsSomeSource]?
For example, if I call rs.GetReportDataSources(report) I get a DataSource[] that contains a data source reference to dsSomeSource. I then want to make some call that returns the actual DataSource [bob] - something like GetDataSourceFromReference(...)
Regards
Andy
October 10th, 2011 7:07pm
As usual one finds the answer five minutes after making the forum post :)
My solution roughly is as follows:-
Given the list of data source references DataSource[] dsList = rs.GetReportDataSources(report.Path); One can check to see if the item is of type DataSourceReference and if it is, retrieve the reference property which points
to the actual data source used.
if (ds[0].item is DataSourceReference)
dataSourceName = ((DataSourceReference)ds[0].item).Reference;
Free Windows Admin Tool Kit Click here and download it now
October 10th, 2011 7:23pm