是否可以更改已发布的sql报告服务报告的连接字符串?我可以在ReportServer数据库中看到名为DataSource的二进制字段,但由于它以二进制形式存储,我认为它不易更新。

我是否需要使用正确的数据源重新发布报告?我希望不要因为我不想安装VS2003。

编辑:客户端正在运行安装了所有Service Pack的SQL Server 2000 Reporting Services。

有帮助吗?

解决方案

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());
}

在此示例中, ReportingService 类取自我生成的用于与Web服务通信的Proxy类,这在[此处]中描述( http://msdn.microsoft.com/en-us/library/aa256607(SQL.80)的.aspx)

我希望这会有所帮助。如果你正在寻找不同的东西,请告诉我。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top