Application.SaveToDtsServer(Package, IDTSEvents, String, String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Enregistre un package dans le système de fichiers.
public:
void SaveToDtsServer(Microsoft::SqlServer::Dts::Runtime::Package ^ pPackage, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ pEvents, System::String ^ sPackagePath, System::String ^ sServerName);
public void SaveToDtsServer (Microsoft.SqlServer.Dts.Runtime.Package pPackage, Microsoft.SqlServer.Dts.Runtime.IDTSEvents pEvents, string sPackagePath, string sServerName);
member this.SaveToDtsServer : Microsoft.SqlServer.Dts.Runtime.Package * Microsoft.SqlServer.Dts.Runtime.IDTSEvents * string * string -> unit
Public Sub SaveToDtsServer (pPackage As Package, pEvents As IDTSEvents, sPackagePath As String, sServerName As String)
Paramètres
- pPackage
- Package
Package à enregistrer.
- pEvents
- IDTSEvents
Objet IDTSEvents.
- sPackagePath
- String
Nom à donner au package en cas d'enregistrement. Vous pouvez le faire précéder d'un chemin d'accès. Par exemple, pour enregistrer un package sous le nom myPackage dans le dossier File System, le paramètre serait @"File System\myPackage".
- sServerName
- String
Nom du serveur où enregistrer le package.
Exemples
L’exemple de code suivant montre un package enregistré dans le dossier Système de fichiers, avec le nom .myFolder2
L’exemple vérifie ensuite si le package a été enregistré en appelant la ExistsOnDtsServer méthode.
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
Exemple de sortie :
Package exists? True