Package.GetPackagePath Method

Returns a String that contains the relative path to the package location.

Namespace: Microsoft.SqlServer.Dts.Runtime
Assembly : Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Syntax

'Declaration
Public Function GetPackagePath As String
public string GetPackagePath ()
public:
virtual String^ GetPackagePath () sealed
public final String GetPackagePath ()
public final function GetPackagePath () : String

Rückgabewert

A String that contains the path to the package.

Hinweise

There are multiple ways to use the GetPackagePath method. In addition to the method shown in the Example section, GetPackagePath can be called on any of the properties in the package and return the path to any property. The following code example shows calls to GetPackagePath for the properties in the first, second, and third positions of the Properties collection.

[C#]

            String prop = p2.Properties[0].GetPackagePath(p2);
            Console.WriteLine("Package properties path = " + prop);

            prop = p2.Properties[1].GetPackagePath(p2);
            Console.WriteLine("Package properties path = " + prop);

            prop = p2.Properties[2].GetPackagePath(p2);
            Console.WriteLine("Package properties path = " + prop);

Sample Output:

Package path = \Package

Package properties path = \Package.CertificateContext

Package properties path = \Package.CertificateObject

Package properties path = \Package.CheckpointFileName

Beispiel

The following code example shows how to retrieve the package path.

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

namespace Package_API
{
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Package pkg = new Package();
            pkg = app.LoadPackage(@"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx", null);
            // Show the package path.
            Console.WriteLine("Package Path: {0}", pkg.GetPackagePath());
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.ScriptTask
 
Namespace Package_API
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim app As Application =  New Application() 
            Dim pkg As Package =  New Package() 
            pkg = app.LoadPackage("C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx", Nothing)
            ' Show the package path.
            Console.WriteLine("Package Path: {0}", pkg.GetPackagePath())
        End Sub
    End Class
End Namespace

Sample Output:

Package Path: \Package

Threadsicherheit

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.

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

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