ConnectionManager.GetPackagePath Method
Gets or sets the path of the package that the connection applies to.
命名空間: 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 package path.
範例
The following code example returns the package path for the two connections in the package.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Connections_Collection
{
class Program
{
static void Main(string[] args)
{
// The package is one of the SSIS Samples.
string mySample = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";
// Create an application and load the sample.
Application app = new Application();
Package pkg = app.LoadPackage(mySample, null);
Connections myConns = pkg.Connections;
// Get the package path.
foreach (ConnectionManager connMgr in myConns)
{
Console.WriteLine("PackagePath: {0}", connMgr.GetPackagePath());
}
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Connections_Collection
Class Program
Shared Sub Main(ByVal args() As String)
' The package is one of the SSIS Samples.
Dim mySample As String = "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"
' Create an application and load the sample.
Dim app As Application = New Application()
Dim pkg As Package = app.LoadPackage(mySample,Nothing)
Dim myConns As Connections = pkg.Connections
' Get the package path.
Dim connMgr As ConnectionManager
For Each connMgr In myConns
Console.WriteLine("PackagePath: {0}", connMgr.GetPackagePath())
Next
End Sub
End Class
End Namespace
Sample Output:
PackagePath: \Package.Connections[{3427BFE1-F10C-4B7E-8E70-E8D9DC7DDBA3}]
PackagePath: \Package.Connections[{48B66F8D-7DFE-4D85-91C7-0999655484B2}]
執行緒安全性
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 的硬體和軟體需求>。
請參閱
參考
ConnectionManager Class
ConnectionManager Members
Microsoft.SqlServer.Dts.Runtime Namespace