LogProviders.Contains Method
Specifies whether an item can be retrieved from the LogProviders collection using indexing without throwing an exception.
네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
구문
‘선언
Public Function Contains ( _
index As Object _
) As Boolean
public bool Contains (
Object index
)
public:
bool Contains (
Object^ index
)
public boolean Contains (
Object index
)
public function Contains (
index : Object
) : boolean
매개 변수
- index
An object that contains the numeric index or identity of the object in the collection.
반환 값
A Boolean that indicates whether items can be retrieved using indexing. A value of true indicates that the syntax LogProviders[x]
can be used without throwing an exception. A value of false indicates that indexing cannot be used to retrieve items from the LogProviders collection.
주의
If a log provider is added using the Add method, the Name of the log provider defaults to a GUID.
예
The following code sample uses Contains method to determine if a log provider with the name "SSIS log provider for Text files" is in the collection. The method returns a Boolean.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace LogProviders_Tests
{
class Program
{
static void Main(string[] args)
{
// The package is one of the SSIS Samples.
string mySample = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";
// Create the Application, and load the sample.
Application app = new Application();
Package pkg = app.LoadPackage(mySample, null);
LogProviders logProvs = pkg.LogProviders;
// Search for the "SSIS log provider for Text files"
// in the collection
if (logProvs.Contains("SSIS log provider for Text files"))
Console.WriteLine("The collection contains {0} provider", logProvs[0].CreationName);
else
Console.WriteLine("The collection does not contain the SSIS log provider for Text files");
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace LogProviders_Tests
Class Program
Shared Sub Main(ByVal args() As String)
' The package is one of the SSIS Samples.
Dim mySample As String = "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"
' Create the Application, and load the sample.
Dim app As Application = New Application()
Dim pkg As Package = app.LoadPackage(mySample,Nothing)
Dim logProvs As LogProviders = pkg.LogProviders
' Search for the "SSIS log provider for Text files"
' in the collection
If logProvs.Contains("SSIS log provider for Text files") Then
Console.WriteLine("The collection contains {0} provider", logProvs(0).CreationName)
Else
Console.WriteLine("The collection does not contain the SSIS log provider for Text files")
End If
End Sub
End Class
End Namespace
Sample Output:
The collection contains DTS.LogProviderTextFile.1 provider
스레드 보안
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
LogProviders Class
LogProviders Members
Microsoft.SqlServer.Dts.Runtime Namespace