共用方式為


TaskHost.HostType Property

Gets a value from the DTSObjectHostType enumeration that describes the host of the container. This property is read-only.

命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

語法

'宣告
<BrowsableAttribute(False)> _
Public ReadOnly Property HostType As DTSObjectHostType
[BrowsableAttribute(false)] 
public DTSObjectHostType HostType { get; }
[BrowsableAttribute(false)] 
public:
virtual property DTSObjectHostType HostType {
    DTSObjectHostType get () sealed;
}
/** @property */
public final DTSObjectHostType get_HostType ()
public final function get HostType () : DTSObjectHostType

屬性值

A DTSObjectHostType enumerator.

範例

The following code example creates a package and adds a Sequence container to it. A FileSystemTask is then added to the task host, and the HostType property is reviewed, returning a value from the DTSObjectHostType enumeration.

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

namespace Microsoft.SqlServer.SSIS.Samples
{
    class mySample
    {
        static void Main(string[] args)
        {
            Package package = new Package();
            Sequence seq = (Sequence)package.Executables.Add("STOCK:SEQUENCE");

            // Add a File System task.
            Executable eFileTask1 = seq.Executables.Add("STOCK:FileSystemTask");
            TaskHost thFileTask1 = eFileTask1 as TaskHost;

            // Use the TaskHost variable to find the DtsObjectHostType.
            DTSObjectHostType hType = thFileTask1.HostType;
            Console.WriteLine("Host Type: {0}", hType);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
 
Namespace Microsoft.SqlServer.SSIS.Samples
    Class mySample
        Shared  Sub Main(ByVal args() As String)
            Dim package As Package =  New Package() 
            Dim seq As Sequence = CType(package.Executables.Add("STOCK:SEQUENCE"), Sequence)
 
            ' Add a File System task.
            Dim eFileTask1 As Executable =  seq.Executables.Add("STOCK:FileSystemTask") 
            Dim thFileTask1 As TaskHost =  eFileTask1 as TaskHost 
 
            ' Use the TaskHost variable to find the DtsObjectHostType.
            Dim hType As DTSObjectHostType =  thFileTask1.HostType 
            Console.WriteLine("Host Type: {0}", hType)
        End Sub
    End Class
End Namespace

Sample Output:

Host Type: Task

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

TaskHost Class
TaskHost Members
Microsoft.SqlServer.Dts.Runtime Namespace