Application.ExistsOnDtsServer Method
Returns a Boolean that indicates whether the specified package already exists on the Integration Services service.
命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
語法
'宣告
Public Function ExistsOnDtsServer ( _
sPackagePath As String, _
sServerName As String _
) As Boolean
public bool ExistsOnDtsServer (
string sPackagePath,
string sServerName
)
public:
bool ExistsOnDtsServer (
String^ sPackagePath,
String^ sServerName
)
public boolean ExistsOnDtsServer (
String sPackagePath,
String sServerName
)
public function ExistsOnDtsServer (
sPackagePath : String,
sServerName : String
) : boolean
參數
- sPackagePath
The fully qualified path of the package.
- sServerName
The name of the server to search for the package.
傳回值
true if the package specified by sPackagePath exists on the server named by sServerName; otherwise, false.
範例
The following code example shows a package being saved to the File System under the parent folder, myFolder2. The example then checks if the package was saved by querying using the ExistsOnDtsServer method.
static void Main(string[] args)
{
// The variable pkg points to the location
// of the ExecuteProcess package sample
// that is installed with the SSIS samples.
string pkg = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
Application app = new Application();
Package p = app.LoadPackage(pkg, null);
// Save the package under myFolder which is found under the
// File System folder on the DTS Service
app.SaveToDtsServer(p, null, @"File System\myFolder2", "yourserver");
// Verify that the package was saved by
// using ExistsOnDtsServer.
Boolean packageExists = app.ExistsOnDtsServer(@"File System\myFolder", "yourserver");
Console.WriteLine("Package exists? " + packageExists);
}
Sub Main(ByVal args() As String)
' The variable pkg points to the location
' of the ExecuteProcess package sample
' that is installed with the SSIS samples.
Dim pkg As String = "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"
Dim app As Application = New Application()
Dim p As Package = app.LoadPackage(pkg,Nothing)
' Save the package under myFolder which is found under the
' File System folder on the DTS Service
app.SaveToDtsServer(p, Nothing, "File System\myFolder2", "yourserver")
' Verify that the package was saved by
' using ExistsOnDtsServer.
Dim packageExists As Boolean = app.ExistsOnDtsServer("File System\myFolder", "yourserver")
Console.WriteLine("Package exists? " + packageExists)
End Sub
Sample Output:
Folder exists? True
Package exists? True
Folder exists? False
執行緒安全性
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 的硬體和軟體需求>。
請參閱
參考
Application Class
Application Members
Microsoft.SqlServer.Dts.Runtime Namespace