TaskHost.GetPackagePath 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回工作位置的路徑。
public:
virtual System::String ^ GetPackagePath();
public string GetPackagePath ();
abstract member GetPackagePath : unit -> string
override this.GetPackagePath : unit -> string
Public Function GetPackagePath () As String
傳回
包含封裝位置的字串。
實作
範例
下列程式碼範例會將 Sequence 容器加入至封裝,然後加入 FileSystemTask 。 使用 GetPackagePath 時,會傳回的封裝路徑 FileSystemTask 。
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 GetPackagePath of the TaskHost.
String pkgPath = thFileTask1.GetPackagePath();
Console.WriteLine("Package path: {0}", pkgPath);
}
}
}
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 GetPackagePath of the TaskHost.
Dim pkgPath As String = thFileTask1.GetPackagePath()
Console.WriteLine("Package path: {0}", pkgPath)
End Sub
End Class
End Namespace
範例輸出:
封裝路徑: \Package \ {4CE5CB4E-E124-4523-BE8B-D934BAF907D5} \ {BFD1E4F1-53CF-4130-989E-E11FD853DA18}