Udostępnij za pośrednictwem


Metoda Application.SaveToDtsServer

Pakiet zapisuje w systemie plików.

Przestrzeń nazw:  Microsoft.SqlServer.Dts.Runtime
Zestaw:  Microsoft.SqlServer.ManagedDTS (w Microsoft.SqlServer.ManagedDTS.dll)

Składnia

'Deklaracja
Public Sub SaveToDtsServer ( _
    pPackage As Package, _
    pEvents As IDTSEvents, _
    sPackagePath As String, _
    sServerName As String _
)
'Użycie
Dim instance As Application
Dim pPackage As Package
Dim pEvents As IDTSEvents
Dim sPackagePath As String
Dim sServerName As String

instance.SaveToDtsServer(pPackage, pEvents, _
    sPackagePath, sServerName)
public void SaveToDtsServer(
    Package pPackage,
    IDTSEvents pEvents,
    string sPackagePath,
    string sServerName
)
public:
void SaveToDtsServer(
    Package^ pPackage, 
    IDTSEvents^ pEvents, 
    String^ sPackagePath, 
    String^ sServerName
)
member SaveToDtsServer : 
        pPackage:Package * 
        pEvents:IDTSEvents * 
        sPackagePath:string * 
        sServerName:string -> unit 
public function SaveToDtsServer(
    pPackage : Package, 
    pEvents : IDTSEvents, 
    sPackagePath : String, 
    sServerName : String
)

Parametry

  • sPackagePath
    Typ: System.String
    Nazwy pakiet podczas zapisywania.Można poprzedzić nazwą ścieżka.Na przykład, aby zapisać pakiet z myPackage nazwę do folderu systemu plików, parametr będzie @"File System\\myPackage".
  • sServerName
    Typ: System.String
    Nazwa serwera, aby zapisać pakiet.

Przykłady

Poniższy przykład kodu pokazuje pakiet są zapisywane w folderze systemu plików z nazwą myFolder2.Przykład sprawdza następnie, jeśli pakiet został zapisany przez wywołanie ExistsOnDtsServer metoda.

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 Integration Services service.
            app.SaveToDtsServer(p, null, @"File System\myFolder2", "yourserver");

            // Verify that the package was saved by calling ExistsOnDtsServer.
            Boolean packageExists = app.ExistsOnDtsServer(@"File System\myFolder2", "yourserver");
            Console.WriteLine("Package exists? " + packageExists);
        }
Shared  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 Integration Services service.
    app.SaveToDtsServer(p, Nothing, "File System\myFolder2", "yourserver")
 
    ' Verify that the package was saved by calling ExistsOnDtsServer.
    Dim packageExists As Boolean =  app.ExistsOnDtsServer("File System\myFolder2","yourserver") 
    Console.WriteLine("Package exists? " + packageExists)
End Sub

Przykładowe dane wyjściowe:

Package exists? True