TestConnectForItemDataSource 方法

测试数据源的连接。此方法支持已发布的数据源的测试,这些数据源由报表或模型和共享数据源使用。此方法适用于报表、模型和数据集项类型。

命名空间:  ReportService2010
程序集:  ReportService2010(在 ReportService2010.dll 中)

语法

声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
Public Function TestConnectForItemDataSource ( _
    ItemPath As String, _
    DataSourceName As String, _
    UserName As String, _
    Password As String, _
    <OutAttribute> ByRef ConnectError As String _
) As Boolean
用法
Dim instance As ReportingService2010
Dim ItemPath As String
Dim DataSourceName As String
Dim UserName As String
Dim Password As String
Dim ConnectError As String
Dim returnValue As Boolean

returnValue = instance.TestConnectForItemDataSource(ItemPath, _
    DataSourceName, UserName, Password, _
    ConnectError)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
public bool TestConnectForItemDataSource(
    string ItemPath,
    string DataSourceName,
    string UserName,
    string Password,
    out string ConnectError
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
public:
bool TestConnectForItemDataSource(
    String^ ItemPath, 
    String^ DataSourceName, 
    String^ UserName, 
    String^ Password, 
    [OutAttribute] String^% ConnectError
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
member TestConnectForItemDataSource : 
        ItemPath:string * 
        DataSourceName:string * 
        UserName:string * 
        Password:string * 
        ConnectError:string byref -> bool 
public function TestConnectForItemDataSource(
    ItemPath : String, 
    DataSourceName : String, 
    UserName : String, 
    Password : String, 
    ConnectError : String
) : boolean

参数

  • ItemPath
    类型:System. . :: . .String
    DataSourceName 要应用到的项的完全限定 URL,其中包括文件名(在 SharePoint 模式下,还有扩展名)。该项可以是共享数据源、报表或报表模型。
  • UserName
    类型:System. . :: . .String
    用来测试连接的用户名。UserName 与提示输入凭据的数据源一起使用。
  • Password
    类型:System. . :: . .String
    用来测试连接的密码。Password 与提示输入凭据的数据源一起使用。
  • ConnectError
    类型:System. . :: . .String%
    一条详细的错误消息。连接失败时会返回此消息。数据源提供程序提供详细消息。

返回值

类型:System. . :: . .Boolean
一个包含详细错误消息的字符串。该字符串作为输出参数 ConnectError 返回。
一个指示连接是否成功建立的布尔值。

注释

The table below shows header and permissions information on this operation.

SOAP Header Usage

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Native Mode Required Permissions

Depends on the item type:

SharePoint Mode Required Permissions

Depends on the item type:

  • Report, DataSet: OpenItems()()()() on ItemPath

  • Report using a model or a shared datasource: OpenItems()()()() on DataSourceName

  • DataSource: OpenItems()()()()

  • Model: OpenItems()()()()

If DataSourceName points to an XML data source, this method does nothing and returns true.