Aracılığıyla paylaş


Application.SaveToSqlServerAs Yöntemi

paket örnek olarak kaydeder SQL Server ile yeni bir ad.

Ad Alanı:  Microsoft.SqlServer.Dts.Runtime
Derleme:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS içinde.dll)

Sözdizimi

'Bildirim
Public Sub SaveToSqlServerAs ( _
    package As Package, _
    events As IDTSEvents, _
    packagePath As String, _
    serverName As String, _
    serverUserName As String, _
    serverPassword As String _
)
'Kullanım
Dim instance As Application
Dim package As Package
Dim events As IDTSEvents
Dim packagePath As String
Dim serverName As String
Dim serverUserName As String
Dim serverPassword As String

instance.SaveToSqlServerAs(package, events, _
    packagePath, serverName, serverUserName, _
    serverPassword)
public void SaveToSqlServerAs(
    Package package,
    IDTSEvents events,
    string packagePath,
    string serverName,
    string serverUserName,
    string serverPassword
)
public:
void SaveToSqlServerAs(
    Package^ package, 
    IDTSEvents^ events, 
    String^ packagePath, 
    String^ serverName, 
    String^ serverUserName, 
    String^ serverPassword
)
member SaveToSqlServerAs : 
        package:Package * 
        events:IDTSEvents * 
        packagePath:string * 
        serverName:string * 
        serverUserName:string * 
        serverPassword:string -> unit 
public function SaveToSqlServerAs(
    package : Package, 
    events : IDTSEvents, 
    packagePath : String, 
    serverName : String, 
    serverUserName : String, 
    serverPassword : String
)

Parametreler

  • packagePath
    Tür: System.String
    Yol ve paket atamak için yeni bir ad.Parametre packagePath biçimi olan \\folder\\packageName. packagePath Varolan bir klasörü belirtilen paket Bu parametre olarak yeni kendi adı. ile kaydedilen
  • serverUserName
    Tür: System.String
    SQL Server Oturum açma adı kullanırsanız SQL Server ; sunucuya oturum açmak için kimlik doğrulama Aksi takdirde, nullnull başvuru (Visual Basic'te Nothing) , Windows kimlik doğrulaması kullanıyorsanız.
  • serverPassword
    Tür: System.String
    SQL Server Oturum açma parolası kullanırsanız SQL Server ; sunucuda oturum kimlik doğrulaması Aksi takdirde, nullnull başvuru (Visual Basic'te Nothing) , Windows kimlik doğrulaması kullanıyorsanız.

Örnekler

Aşağıdaki kod örneği için ExecuteProcess.dtsx adlı örnek paket kaydeder msdb klasörü, yeni bir adla myNewPackage.paket kaydedilmiş doğrulamak için aşağıdaki Transact-sql sorgusu çalıştırın msdb veritabanı.Sorgu döndürür depolanan tüm paketleri msdb Sistem tablo.

select * from sysssispackages

Veya bağlanmak Integration Services hizmet, genişletme Depolanan paketlerive sonra msdb.Belirtilen ada sahip bir paket packagePath listelenecektir.

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 to the SQL Server msdb folder, which is
           // also the MSDB folder in the Integration Services service, or as a row in the
           //sysssispackages table.
            app.SaveToSqlServerAs(p, null, "myNewPackage", "yourserver", null, null);
        }
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 to the SQL Server msdb folder, which is
           ' also the MSDB folder in the Integration Services service, or as a row in the
           'sysssispackages table.
            app.SaveToSqlServerAs(p, Nothing, "myNewPackage", "yourserver", Nothing, Nothing)
End Sub