다음을 통해 공유


ExistsOnDtsServer 메서드

Returns a Boolean that indicates whether the specified package already exists on the Integration Services service.

네임스페이스:  Microsoft.SqlServer.Dts.Runtime
어셈블리:  Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)

구문

‘선언
Public Function ExistsOnDtsServer ( _
    sPackagePath As String, _
    sServerName As String _
) As Boolean
‘사용 방법
Dim instance As Application
Dim sPackagePath As String
Dim sServerName As String
Dim returnValue As Boolean

returnValue = instance.ExistsOnDtsServer(sPackagePath, _
    sServerName)
public bool ExistsOnDtsServer(
    string sPackagePath,
    string sServerName
)
public:
bool ExistsOnDtsServer(
    String^ sPackagePath, 
    String^ sServerName
)
member ExistsOnDtsServer : 
        sPackagePath:string * 
        sServerName:string -> bool 
public function ExistsOnDtsServer(
    sPackagePath : String, 
    sServerName : String
) : boolean

매개 변수

반환 값

유형: System. . :: . .Boolean
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\100\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\100\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