다음을 통해 공유


LogEntryInfos.Add(String, String, DTSLogEntryFrequency) 메서드

정의

LogEntryInfo 컬렉션에 새 LogEntryInfos 개체를 추가합니다.

public:
 void Add(System::String ^ name, System::String ^ description, Microsoft::SqlServer::Dts::Runtime::DTSLogEntryFrequency frequencyHint);
public void Add (string name, string description, Microsoft.SqlServer.Dts.Runtime.DTSLogEntryFrequency frequencyHint);
member this.Add : string * string * Microsoft.SqlServer.Dts.Runtime.DTSLogEntryFrequency -> unit
Public Sub Add (name As String, description As String, frequencyHint As DTSLogEntryFrequency)

매개 변수

name
String

컬렉션에 추가할 로그 항목의 이름입니다.

description
String

로그 항목에 대한 설명입니다.

frequencyHint
DTSLogEntryFrequency

DTSLogEntryFrequency 열거자의 유효한 값 중 하나입니다.

예제

다음 코드 샘플에서는 컬렉션에 로그 항목을 추가합니다.

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

namespace LogEntryInfosTest  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            // The package is one of the SSIS Samples.  
            string mySample = @"C:\Program Files\Microsoft SQL Server\100\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);  

            // Get the LogEntryInfos from the package.  
            LogEntryInfos logInfos = pkg.LogEntryInfos;  

            //Note how many log entries exist before adding one.  
            String countLEI = logInfos.Count.ToString();  
            Console.WriteLine("Entries at beginning: {0}", countLEI);  

            String newName = "My new log entry info";  
            String newDesc = "My new Description";  
            DTSLogEntryFrequency newFreq = DTSLogEntryFrequency.Consistent;  
            logInfos.Add(newName, newDesc, newFreq);  

            //Note how many log entries exist after adding one.  
            countLEI = logInfos.Count.ToString();  
            Console.WriteLine("Entries after adding one: {0}", countLEI);  

            //Now remove the entry just added.  
            logInfos.Remove("My new log entry info");  
            countLEI = logInfos.Count.ToString();  
            Console.WriteLine("Entries after Remove: {0}", countLEI);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace LogEnTryInfosTest  
    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\100\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)   

            ' Get the LogEntryInfos from the package.  
            Dim logInfos As LogEnTryInfos =  pkg.LogEnTryInfos   

            'Note how many log entries exist before adding one.  
            Dim countLEI As String =  logInfos.Count.ToString()   
            Console.WriteLine("Entries at beginning: {0}", countLEI)  

            Dim NewName As String =  "My new log entry info"   
            Dim NewDesc As String =  "My new Description"   
            Dim NewFreq As DTSLogEnTryFrequency =  DTSLogEnTryFrequency.Consistent   
            logInfos.Add(NewName, NewDesc, NewFreq)  

            'Note how many log entries exist after adding one.  
            countLEI = logInfos.Count.ToString()  
            Console.WriteLine("Entries after adding one: {0}", countLEI)  

            'Now remove the entry just added.  
            logInfos.Remove("My new log entry info")  
            countLEI = logInfos.Count.ToString()  
            Console.WriteLine("Entries after Remove: {0}", countLEI)  
         End Sub  
    End Class  
End Namespace  

샘플 출력:

시작 항목: 1

항목을 추가한 후 항목: 2

제거 후 항목: 1

적용 대상