共用方式為


IsolationLevel 屬性

Gets or sets the isolation level of the transaction in the DtsContainer object.

命名空間:  Microsoft.SqlServer.Dts.Runtime
組件:  Microsoft.SqlServer.ManagedDTS (在 Microsoft.SqlServer.ManagedDTS.dll 中)

語法

'宣告
Public Property IsolationLevel As IsolationLevel
    Get
    Set
'用途
Dim instance As DtsContainer
Dim value As IsolationLevel

value = instance.IsolationLevel

instance.IsolationLevel = value
public IsolationLevel IsolationLevel { get; set; }
public:
property IsolationLevel IsolationLevel {
    IsolationLevel get ();
    void set (IsolationLevel value);
}
member IsolationLevel : IsolationLevel with get, set
function get IsolationLevel () : IsolationLevel
function set IsolationLevel (value : IsolationLevel)

屬性值

型別:System.Data. . :: . .IsolationLevel
An integer value that corresponds to the isolation level.

備註

The default value of this property is -1, or Unspecified. For more information about isolation levels, see Database Engine 中的隔離等級. For more information about the available values, see the IsolationLevel enumerations that are used in the System.Data namespace, in ADO and in OLE DB.

The following table lists the values that are available for the IsolationLevel property.

Value

Isolation Level

-1

Unspecified

16

Chaos

256

ReadUncommitted

4096

ReadCommitted

65536

RepeatableRead

1048576

Serializable

The value of the IsolationLevel property requested by a child container is ignored when the following conditions are true:

  • The value of the child container's TransactionOption property is Supported.

  • The child container joins the transaction of a parent container.

The value of the IsolationLevel property requested by the container is respected only when the container initiates a new transaction. A container initiates a new transaction when the following conditions are true:

  • The value of the container's TransactionOption property is Required.

  • The parent has not already started a transaction.

範例

The following code example creates a Package, which is a class that inherits from DtsContainer. The Package shows the use of several inherited properties.

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

Sample Output:

Package Name: My DtsContainer inheritance test package

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

FailPackageOnFailure: False

FailParentOnFailure: False

Locale ID: 1033

Is DefaultLocaleID? False

Isolation Level: Serializable

LoggingMode: UseParentSetting

MaximumErrorCount: 1

TransactionOption: Supported