다음을 통해 공유


LoggingOptions.GetColumnFilter Method

Returns column filter for the specified event.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

구문

‘선언
Public Sub GetColumnFilter ( _
    eventName As String, _
    ByRef columnFilter As DTSEventColumnFilter _
)
public void GetColumnFilter (
    string eventName,
    ref DTSEventColumnFilter columnFilter
)
public:
void GetColumnFilter (
    String^ eventName, 
    DTSEventColumnFilter% columnFilter
)
public void GetColumnFilter (
    String eventName, 
    /** @ref */ DTSEventColumnFilter columnFilter
)
JScript는 값 유형 인수를 참조로 전달하는 것을 지원하지 않습니다.

매개 변수

  • eventName
    The name of the event whose columns you want to control.
  • columnFilter
    A DTSEventColumnFilter with values set to true or false, depending on if the column is included (true) or excluded (false).

The following code example creates a Package and selects a log provider for it. The code example then sets the fields of the DTSEventColumnFilter to true to include that field in the log, or false to exclude the field from the log. The SetColumnFilter then defines that the fields with a value of true are logged when the package incurs an OnError event. A new DTSEventColumnFilter is created, and filled with the values from the existing filter using GetColumnFilter.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace HttpClientConn
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            LogProvider log1 = pkg.LogProviders.Add("DTS.LogProviderTextFile.1");
            pkg.LoggingOptions.SelectedLogProviders.Add(log1);
            LoggingOptions lOpts = pkg.LoggingOptions;

            DTSEventColumnFilter ecf = new DTSEventColumnFilter();
            // Set the detailed information to log when the event occurs.
            // This specifies to log the Computer, Operator, and SourceName only.
            ecf.Computer = true;
            ecf.Operator = true;
            ecf.SourceName = true;
            ecf.SourceID = false;
            ecf.ExecutionID = false;
            ecf.MessageText = false;
            ecf.DataBytes = false;
            // The event is the first parameter, and the columns to log is the enumeration. 
            lOpts.SetColumnFilter("OnError", ecf);

            // Now that the column filters are set, retrieve them using 
            // GetColumnFilter.
            DTSEventColumnFilter newECF = new DTSEventColumnFilter();
            lOpts.GetColumnFilter("OnError", ref newECF);

            // Show that the new DTSEventColumnFilter has been set properly.
            Console.WriteLine("Computer: {0}", newECF.Computer);
            Console.WriteLine("Operator: {0}", newECF.Operator);
            Console.WriteLine("SourceName: {0}", newECF.SourceName);
            Console.WriteLine("SourceID: {0}", newECF.SourceID);
            Console.WriteLine("ExecutionID: {0}", newECF.ExecutionID);
            Console.WriteLine("MessageText: {0}", newECF.MessageText);
            Console.WriteLine("DataBytes: {0}", newECF.DataBytes);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace HttpClientConn
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim log1 As LogProvider =  pkg.LogProviders.Add("DTS.LogProviderTextFile.1") 
            pkg.LoggingOptions.SelectedLogProviders.Add(log1)
            Dim lOpts As LoggingOptions =  pkg.LoggingOptions 
 
            Dim ecf As DTSEventColumnFilter =  New DTSEventColumnFilter() 
            ' Set the detailed information to log when the event occurs.
            ' This specifies to log the Computer, Operator, and SourceName only.
            ecf.Computer = True
            ecf.Operator = True
            ecf.SourceName = True
            ecf.SourceID = False
            ecf.ExecutionID = False
            ecf.MessageText = False
            ecf.DataBytes = False
            ' The event is the first parameter, and the columns to log is the enumeration. 
            lOpts.SetColumnFilter("OnError", ecf)
 
            ' Now that the column filters are set, retrieve them using 
            ' GetColumnFilter.
            Dim NewECF As DTSEventColumnFilter =  New DTSEventColumnFilter() 
            lOpts.GetColumnFilter("OnError",ref NewECF)
 
            ' Show that the new DTSEventColumnFilter has been set properly.
            Console.WriteLine("Computer: {0}", NewECF.Computer)
            Console.WriteLine("Operator: {0}", NewECF.Operator)
            Console.WriteLine("SourceName: {0}", NewECF.SourceName)
            Console.WriteLine("SourceID: {0}", NewECF.SourceID)
            Console.WriteLine("ExecutionID: {0}", NewECF.ExecutionID)
            Console.WriteLine("MessageText: {0}", NewECF.MessageText)
            Console.WriteLine("DataBytes: {0}", NewECF.DataBytes)
        End Sub
    End Class
End Namespace

Sample Output:

Computer: True

Operator: True

SourceName: True

SourceID: False

ExecutionID: False

MessageText: False

DataBytes: False

스레드 보안

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 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

LoggingOptions Class
LoggingOptions Members
Microsoft.SqlServer.Dts.Runtime Namespace