我在报表服务器上为我的报表使用 RDCE。为了让我的报告正常工作,我必须将“UsedInQuery”参数设置为 true,默认情况下为 false。但是,这不是可以在设计时设置的参数。部署后必须手动配置参数。
这样做的一个原因是通过首先找到报告来操作报告服务器数据库目录:
select ItemID
,Path,Name,Description
,cast(Property as xml) as Property
,cast(Parameter as xml) as Parameter
from dbo.Catalog
where name like 'list of databases%'
然后使用更改的参数值更新报告参数
update Catalog
set Parameter='
<Parameters>
<UserProfileState>0</UserProfileState>
<Parameter>
...
<UsedInQuery>True</UsedInQuery>
...
</Parameter>
</Parameters>'
where ItemID='someID'
现在这一切都很好,而且一切正常,但是每次都必须像这样操作数据库并不好。因此,我正在研究报告服务的 Web 服务可以做什么。
我的问题是,除了直接操作数据库之外,是否可以通过其他方式更改报告参数?最好通过 Reporting Services 提供的 Web 服务。
我发现这种方法接近我想要的:
SetItemParameters(path, parameters)
基本上,如果我可以设置UsedInQuery参数,上述方法就可以满足我的需求。但是,当尝试通过上述行更改参数时,根本不会更改任何内容。我不确定我在这里做错了什么。
这是我的代码的一部分,请记住它是在 Borland C++ 中:
NS_ReportService2010::ItemParameter *itemPar = new NS_ReportService2010::ItemParameter();
itemPar->Name = "language";
itemPar->QueryParameter = System::True;
// itemPar->AllowBlank = true;
NS_ReportService2010::ArrayOfItemParameter *itemParameters = new NS_ReportService2010::ArrayOfItemParameter();
itemParameters->set_length(1);
itemParameters->operator [](0) = itemPar;
ReportingService->SetItemParameters("/myreport", *itemParameters);
我在更新中做错了什么吗?
编辑:
在 Ron5504 的回复之后,我查看了日志文件并得到了这个:
runningrequests!ReportServer_0-2!6b4!07/30/2013-13:57:39:: v VERBOSE: SoapAction: "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetItemParameters"
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: v VERBOSE: Constructed Stream Factory 'StreamFactory:19aa4462-dc7a-4a19-a505-1d0a96ce7fc4' of type 'Microsoft.ReportingServices.Library.MemoryThenFileStreamFactory'
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: i INFO: Call to GetItemTypeAction(/TestReport).
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: i INFO: Call to GetItemTypeAction completed. Returns 2.
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: i INFO: Call to SetReportParametersAction(/TestReport).
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: v VERBOSE: Transaction begin.
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: i INFO: Call to SetReportParametersAction completed.
library!ReportServer_0-2!6b4!07/30/2013-13:57:39:: v VERBOSE: Transaction commit.
rshost!rshost!6b4!07/30/2013-13:57:39:: v VERBOSE: HttpPipelineCallback::EndOfRequest(): continue pipeline=0x00000002781A5AF0.
rshost!rshost!b5c!07/30/2013-13:57:39:: v VERBOSE: ThreadContinuePipeline: processing request on pipeline=0x00000002781A5AF0, state=2, IOError=0, node=0.
rshost!rshost!828!07/30/2013-13:57:43:: v VERBOSE: HttpPipeline::DisconnectCallback: releasing pipeline=0x00000002781A5AF0.
rshost!rshost!b5c!07/30/2013-13:57:43:: v VERBOSE: ThreadContinuePipeline: processing request on pipeline=0x00000002781A5AF0, state=0, IOError=2250, node=0.
rshost!rshost!b5c!07/30/2013-13:57:43:: v VERBOSE: State machine disconnected pipeline=0x00000002781A5AF0, state=4 ...
rshost!rshost!b5c!07/30/2013-13:57:43:: v VERBOSE: HttpPipeline::DoStateDisconnected: releasing pipeline=0x00000002781A5AF0.
rshost!rshost!b5c!07/30/2013-13:57:43:: v VERBOSE: HttpPipeline::ReleaseOnce: releasing pipeline=0x00000002781A5AF0.
rshost!rshost!b5c!07/30/2013-13:57:43:: v VERBOSE: Destroying pipeline=0x00000002781A5AF0, callback=0x0000000278138720 ...
library!WindowsService_0!224!07/30/2013-13:57:46:: v VERBOSE: Starting database version check timer.
library!WindowsService_0!224!07/30/2013-13:57:46:: v VERBOSE: Verifying DB version.
library!WindowsService_0!224!07/30/2013-13:57:46:: v VERBOSE: Database version check timer executed.
library!WindowsService_0!122c!07/30/2013-13:58:46:: v VERBOSE: Starting database version check timer.
library!WindowsService_0!122c!07/30/2013-13:58:46:: v VERBOSE: Verifying DB version.
library!WindowsService_0!122c!07/30/2013-13:58:46:: v VERBOSE: Database version check timer executed.
此外,我想补充一点,我发现了如何在设计器模式下做到这一点。通过转到报告参数的高级选项卡。然后将“参数更改时刷新数据:”设置为“始终刷新”。尽管如此,我的问题仍然存在,我想知道是否可以通过 SetItemParameters 方法。