SQL Reporting Services 2000具有[Web服务]。(
http://msdn.microsoft.com/en-us/library/aa274396(SQL.80).aspx)
可用于更改数据源的。鉴于此,下面允许将数据源更改为共享数据源。这是[改编自msdn]。(
http://msdn.microsoft.com/en-us/library/aa225896(SQL.80).aspx)
.
// Create our reporting services class
ReportingService theRS = new ReportingService();
theRS.Credentials = System.Net.CredentialCache.DefaultCredentials;
// We need to setup a data source reference to an existing shared data source
DataSourceReference theDSRef = new DataSourceReference();
theDSRef.Reference = "/Path/To/ExistingSharedDataSource";
DataSource[] theDSArray = new DataSource[1];
DataSource theDS = new DataSource();
theDS.Item = (DataSourceReference)theDSRef;
theDS.Name = "NameOfSharedDataSource";
theDSArray[0] = theDS;
try
{
// Attempt to change the data source of the report
theRS.SetReportDataSources("/Path/To/ReportName", theDSArray);
Console.Out.WriteLine("We have changed the data source");
}
catch (System.Web.Services.Protocols.SoapException e)
{
Console.Out.WriteLine(e.Message);
Console.Out.WriteLine(e.Detail.InnerXml.ToString());
}
在这个例子中,
报告服务
类是从我生成用于与Web服务对话的代理类中获取的,如[此处]所述。(
http://msdn.microsoft.com/en-us/library/aa256607(SQL.80).aspx)
.
我希望这对一些人有帮助。如果你在找不同的东西,请告诉我。