DtsContainer.FailPackageOnFailure 属性

定义

获取或设置一个布尔值,该值指示子容器失败时包是否失败。 此属性用于容器,不用于包本身。

public:
 property bool FailPackageOnFailure { bool get(); void set(bool value); };
[Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyCategory(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "PropertyCategoryExecution")]
[Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "FailPackageOnFailureDesc")]
public bool FailPackageOnFailure { get; set; }
[<Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyCategory(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "PropertyCategoryExecution")>]
[<Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "FailPackageOnFailureDesc")>]
member this.FailPackageOnFailure : bool with get, set
Public Property FailPackageOnFailure As Boolean

属性值

true 表示容器中的失败将包执行结果设置为失败。

属性

示例

下面的代码示例创建一个 Package从中继承的 DtsContainer类。 显示 Package 多个继承属性的使用。

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

namespace Microsoft.SqlServer.SSIS.Samples  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Application app = new Application();  
            Package pkg = new Package();  

            // Package name must be assigned.  
            pkg.Name = "My DtsContainer inheritance test package";  

            // Display the values that manually assigned.  
            Console.WriteLine("Package Name: {0}", pkg.Name);  

            // Packages are assigned the following default values when created.  
            Console.WriteLine("Package ID:           {0}", pkg.ID);  
            Console.WriteLine("FailPackageOnFailure: {0}", pkg.FailPackageOnFailure);  
            Console.WriteLine("FailParentOnFailure:  {0}", pkg.FailParentOnFailure);  
            Console.WriteLine("Locale ID:            {0}", pkg.LocaleID);  
            Console.WriteLine("Is DefaultLocaleID?   {0}", pkg.IsDefaultLocaleID);  
            Console.WriteLine("Isolation Level:      {0}", pkg.IsolationLevel);  
            Console.WriteLine("LoggingMode:          {0}", pkg.LoggingMode);  
            Console.WriteLine("MaximumErrorCount:    {0}", pkg.MaximumErrorCount);  
            Console.WriteLine("TransactionOption:    {0}", pkg.TransactionOption);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Microsoft.SqlServer.SSIS.Samples  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim app As Application =  New Application()   
            Dim pkg As Package =  New Package()   

            ' Package name must be assigned.  
            pkg.Name = "My DtsContainer inheritance test package"  

            ' Display the values that manually assigned.  
            Console.WriteLine("Package Name: {0}", pkg.Name)  

            ' Packages are assigned the following default values when created.  
            Console.WriteLine("Package ID:           {0}", pkg.ID)  
            Console.WriteLine("FailPackageOnFailure: {0}", pkg.FailPackageOnFailure)  
            Console.WriteLine("FailParentOnFailure:  {0}", pkg.FailParentOnFailure)  
            Console.WriteLine("Locale ID:            {0}", pkg.LocaleID)  
            Console.WriteLine("Is DefaultLocaleID?   {0}", pkg.IsDefaultLocaleID)  
            Console.WriteLine("Isolation Level:      {0}", pkg.IsolationLevel)  
            Console.WriteLine("LoggingMode:          {0}", pkg.LoggingMode)  
            Console.WriteLine("MaximumErrorCount:    {0}", pkg.MaximumErrorCount)  
            Console.WriteLine("TransactionOption:    {0}", pkg.TransactionOption)  
        End Sub  
    End Class  
End Namespace  

示例输出:

包名称:My DtsContainer 继承测试包

包 ID:{2C2FAA96-35BA-4C5E-A39A-C5D7D30A0D79}

FailPackageOnFailure: False

FailParentOnFailure: False

区域设置 ID:1033

DefaultLocaleID 是吗? False

隔离级别:可序列化

LoggingMode:UseParentSetting

MaximumErrorCount: 1

TransactionOption:支持

注解

如果 FailPackageOnFailure 容器 true 的执行结果为失败,则分配给作为失败容器父级的包的执行结果也失败。 这会导致包终止。 此事件定义可重启的包失败。 由于无法取消其执行而未完成的包无法重新启动。 有关详细信息,请参阅 通过使用检查点重新启动包

不能在 Package. 上设置此属性。 将此值设置为 true 包将导致错误。

适用于