Application.SaveToDtsServer(Package, IDTSEvents, String, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将包保存到文件系统。
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)
参数
- pPackage
- Package
要保存的包。
- pEvents
- IDTSEvents
一个 IDTSEvents 对象。
- sPackagePath
- String
保存包时提供给包的名称。 可以在路径之前加上名称前缀。 例如,若要将名为 myPackage 的包保存到 File System 文件夹,则参数应为 @"File System\myPackage"。
- sServerName
- String
要将包保存到的服务器的名称。
示例
下面的代码示例显示一个包保存到文件系统文件夹,其名称为 myFolder2
a0/>。 然后,该示例通过调用 ExistsOnDtsServer 该方法检查包是否已保存。
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
示例输出:
Package exists? True