Condividi tramite


LoggingOptions.SetColumnFilter(String, DTSEventColumnFilter) Metodo

Definizione

Imposta il filtro di colonna per l'evento specificato.

public:
 void SetColumnFilter(System::String ^ eventName, Microsoft::SqlServer::Dts::Runtime::DTSEventColumnFilter columnFilter);
public void SetColumnFilter (string eventName, Microsoft.SqlServer.Dts.Runtime.DTSEventColumnFilter columnFilter);
member this.SetColumnFilter : string * Microsoft.SqlServer.Dts.Runtime.DTSEventColumnFilter -> unit
Public Sub SetColumnFilter (eventName As String, columnFilter As DTSEventColumnFilter)

Parametri

eventName
String

Nome dell'evento di cui si desidera controllare le colonne.

columnFilter
DTSEventColumnFilter

Oggetto DTSEventColumnFilter con valori impostati su true o false, a seconda che si voglia che la colonna sia inclusa (true) o esclusa (false).

Esempio

Nell'esempio di codice seguente viene creato un Package oggetto e viene selezionato un provider di log. L'esempio di codice imposta quindi i campi dell'oggetto DTSEventColumnFilter da true includere nel log o false per escludere il campo dal log. Definisce SetColumnFilter quindi che i campi con un valore di true vengono registrati quando il pacchetto comporta un OnError evento.

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);  
        }  
    }  
}  
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)  
        End Sub  
    End Class  
End Namespace  

Si applica a