SetColumnFilter 方法
Sets column filter for the specified event.
命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (在 Microsoft.SqlServer.ManagedDTS.dll 中)
語法
'宣告
Public Sub SetColumnFilter ( _
eventName As String, _
columnFilter As DTSEventColumnFilter _
)
'用途
Dim instance As LoggingOptions
Dim eventName As String
Dim columnFilter As DTSEventColumnFilter
instance.SetColumnFilter(eventName, columnFilter)
public void SetColumnFilter(
string eventName,
DTSEventColumnFilter columnFilter
)
public:
void SetColumnFilter(
String^ eventName,
DTSEventColumnFilter columnFilter
)
member SetColumnFilter :
eventName:string *
columnFilter:DTSEventColumnFilter -> unit
public function SetColumnFilter(
eventName : String,
columnFilter : DTSEventColumnFilter
)
參數
- eventName
型別:System. . :: . .String
The name of the event whose columns you want to control.
- columnFilter
型別:Microsoft.SqlServer.Dts.Runtime. . :: . .DTSEventColumnFilter
A DTSEventColumnFilter with values set to true or false, depending on if you want the column 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.
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.2");
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.2")
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