Export (0) Print
Expand All
Expand Minimize

SetReportDataSources Method

SQL Server 2000

ReportingService.SetReportDataSources Method

Sets the properties that are associated with the data sources of a specified report.

Public Sub SetReportDataSources( _
   ByVal Report As String _
   ByVal DataSources() As [Namespace].DataSource _
)
   Member of [Namespace].ReportingService

public void SetReportDataSources(
   string Report,
   [Namespace].DataSource[] DataSources
);
   Member of [Namespace].ReportingService
Parameters
Report
The full path name of the report.
DataSources
An array of DataSource[] objects that contains a list of data sources and their associated properties.
Permissions

Operation Description
Update Data Sources Required on the report to update data source properties.

Remarks

The report server throws an exception if the SetReportDataSources method is used to set the data source properties of a linked report. If a data source that is passed in the DataSources parameter is not associated with the given report, a SOAP exception is thrown with the error code rsDataSourceNotFound.

Example

To compile the following code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following example code uses the SetReportDataSources method to set the data source definition for an existing shared data source named AdventureWorks:

Imports System
Imports System.Web.Services.Protocols

Class Sample
   
   Public Shared Sub Main()
      Dim rs As New ReportingService()
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials
      
      Dim reference As New DataSourceReference()
      reference.Reference = "/SampleReports/AdventureWorks"
      Dim dataSources(1) As DataSource
      Dim ds As New DataSource()
      ds.Item = CType(reference, DataSourceDefinitionOrReference)
      ds.Name = "AdventureWorks"
      dataSources(0) = ds
      
      Try
         rs.SetReportDataSources("/SampleReports/Product Catalog", dataSources)
         Console.WriteLine("New reference set for the report.")
      
      Catch e As SoapException
         Console.WriteLine(e.Detail.InnerXml.ToString())
      End Try
   End Sub 'Main
End Class 'Sample

using System;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService rs = new ReportingService();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
      
      DataSourceReference reference = new DataSourceReference();
      reference.Reference = "/SampleReports/AdventureWorks";
      DataSource[] dataSources = new DataSource[1];
      DataSource ds = new DataSource();
      ds.Item = (DataSourceDefinitionOrReference) reference;
      ds.Name = "AdventureWorks";
      dataSources[0] = ds;

      try
      {
         rs.SetReportDataSources("/SampleReports/Product Catalog", dataSources);
         Console.WriteLine("New reference set for the report.");
      }

      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
      }
   }
}
See Also

ReportingService Class

Reporting Services Web Service Library

Show:
© 2014 Microsoft