LoggingOptions.GetColumnFilter(String, DTSEventColumnFilter) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回指定之事件的資料行篩選。
public:
void GetColumnFilter(System::String ^ eventName, Microsoft::SqlServer::Dts::Runtime::DTSEventColumnFilter % columnFilter);
public void GetColumnFilter (string eventName, ref Microsoft.SqlServer.Dts.Runtime.DTSEventColumnFilter columnFilter);
member this.GetColumnFilter : string * DTSEventColumnFilter -> unit
Public Sub GetColumnFilter (eventName As String, ByRef columnFilter As DTSEventColumnFilter)
參數
- eventName
- String
您想要控制資料行的事件名稱。
- columnFilter
- DTSEventColumnFilter
DTSEventColumnFilter,其值設定為 true 或 false,取決於資料行是否包含(true)或排除(false)。
範例
下列程式碼範例會建立 Package 並為其選取記錄提供者。 然後,此程式碼範例會將的欄位設定為, DTSEventColumnFilter true 以在記錄檔中包含該欄位,或將欄位 false 從記錄檔中排除。 SetColumnFilter接著 true 會定義當封裝產生事件時,會記錄值為的欄位 OnError 。 DTSEventColumnFilter隨即會建立新的,並使用來自現有篩選的值填入 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
範例輸出:
電腦: True
Operator: True
未通過的內容: True
SourceID: False
ExecutionID: False
MessageText: False
DataBytes: False