ForEachLoop.GetPackagePath Method

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

命名空间: Microsoft.SqlServer.Dts.Runtime
程序集: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

语法

声明
Public Function GetPackagePath As String
public string GetPackagePath ()
public:
virtual String^ GetPackagePath () sealed
public final String GetPackagePath ()
public final function GetPackagePath () : String

返回值

A String that contains the path to the package.

示例

The following code example creates a ForEachLoop, sets some properties using the Properties collection ,and retrieves the package path.

// Create the new package.
Package package = new Package();
// Add variables.
package.Variables.Add("Id", false, "User", 0);
// Create ForEachLoop task
Executables executables = package.Executables;
ForEachLoop forEachLoop = executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;
// Set properties on the ForEachLoop, like name and description.
// Show how to set them using the Properties collection.
forEachLoop.Properties["Name"].SetValue(forEachLoop, "ForEachLoop Container");
forEachLoop.Properties["Description"].SetValue(forEachLoop, "ForEachLoop Container");

// Retrieve the package path of the loop.
String path = forEachLoop.GetPackagePath();
Console.WriteLine("Package path: {0}", path);
' Create the new package.
Dim package As Package =  New Package() 
' Add variables.
package.Variables.Add("Id", False, "User", 0)
' Create ForEachLoop task
Dim executables As Executables =  package.Executables 
Dim forEachLoop As ForEachLoop =  executables.Add("STOCK:FOREACHLOOP") as ForEachLoop 
' Set properties on the ForEachLoop, like name and description.
' Show how to set them using the Properties collection.
forEachLoop.Properties("Name").SetValue(forEachLoop, "ForEachLoop Container")
forEachLoop.Properties("Description").SetValue(forEachLoop, "ForEachLoop Container")
 
' Retrieve the package path of the loop.
Dim path As String =  forEachLoop.GetPackagePath() 
Console.WriteLine("Package path: {0}", path)

Sample Output:

Package path: \Package\ForEachLoop Container

线程安全

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 的硬件和软件要求。

请参阅

参考

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