DTSExecResult 열거형

정의

태스크 실행의 결과에 대해 설명하는 값을 제공합니다.

public enum class DTSExecResult
public enum DTSExecResult
type DTSExecResult = 
Public Enum DTSExecResult
상속
DTSExecResult

필드

Canceled 3

태스크가 취소되었습니다 (값 = 3)

Completion 2

태스크 실행이 완료되었습니다 (값 = 2)

Failure 1

태스크가 실패했습니다. (값 = 1)

Success 0

태스크가 성공적으로 실행되었습니다 (값 = 0)

예제

다음 코드 예제에서는 패키지에서 열거형을 DTSExecResult 사용하는 한 가지 방법을 보여 있습니다. 클래스는 Package 이 열거형을 메서드에 대한 Execute 반환 값으로 사용하여 패키지의 성공 또는 실패 상태를 확인합니다.

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

namespace Package_API  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Package p = new Package();  
            p.InteractiveMode = true;  
            p.OfflineMode = true;  

            // Add a Script Task to the package.  
            TaskHost taskH = (TaskHost)p.Executables.Add("STOCK:ScriptTask");  
            // Run the package.  
            p.Execute();  
            // Review the results of the run.  
            if (taskH.ExecutionResult == DTSExecResult.Failure || taskH.ExecutionStatus == DTSExecStatus.Abend)  
                Console.WriteLine("Task failed or abended");  
            else  
                Console.WriteLine("Task ran successfully");  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.ScriptTask  

Namespace Package_API  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim p As Package =  New Package()   
            p.InteractiveMode = True  
            p.OfflineMode = True  

            ' Add a Script Task to the package.  
            Dim taskH As TaskHost = CType(p.Executables.Add("STOCK:ScriptTask"), TaskHost)  
            ' Run the package.  
            p.Execute()  
            ' Review the results of the run.  
            If taskH.ExecutionResult = DTSExecResult.Failure Or taskH.ExecutionStatus = DTSExecStatus.Abend Then  
                Console.WriteLine("Task failed or abended")  
            Else   
                Console.WriteLine("Task ran successfully")  
            End If  
        End Sub  
    End Class  
End Namespace  

샘플 출력:

작업이 성공적으로 실행됨

설명

런타임 엔진은 메서드 구현을 호출하여 패키지 또는 컨테이너에 포함된 작업을 처리합니다 Execute . 태스크는 이 메서드에서 핵심 논리와 기능을 구현하고 메시지를 게시하고 열거형에서 DTSExecResult 값을 반환하여 실행 결과를 제공합니다.

적용 대상