Partager via


GetPackagePath méthode

Returns the path to the task location.

Espace de noms :  Microsoft.SqlServer.Dts.Runtime
Assembly :  Microsoft.SqlServer.ManagedDTS (dans Microsoft.SqlServer.ManagedDTS.dll)

Syntaxe

'Déclaration
Public Function GetPackagePath As String
'Utilisation
Dim instance As TaskHost
Dim returnValue As String

returnValue = instance.GetPackagePath()
public string GetPackagePath()
public:
virtual String^ GetPackagePath() sealed
abstract GetPackagePath : unit -> string 
override GetPackagePath : unit -> string 
public final function GetPackagePath() : String

Valeur de retour

Type : System. . :: . .String
A String that contains the location of the package.

Implémente

IDTSPackagePath. . :: . .GetPackagePath() () () ()

Exemples

The following code example adds a Sequence container to a package, then adds a FileSystemTask. Using GetPackagePath, the path of the package for the FileSystemTask is returned.

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

Sample Output:

Package path: \Package\{4CE5CB4E-E124-4523-BE8B-D934BAF907D5}\{BFD1E4F1-53CF-4130-989E-E11FD853DA18}