Application.SaveToXml(String, Package, IDTSEvents) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将包的 XML 定义保存到文件。
public:
void SaveToXml(System::String ^ fileName, Microsoft::SqlServer::Dts::Runtime::Package ^ package, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events);
public void SaveToXml (string fileName, Microsoft.SqlServer.Dts.Runtime.Package package, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events);
member this.SaveToXml : string * Microsoft.SqlServer.Dts.Runtime.Package * Microsoft.SqlServer.Dts.Runtime.IDTSEvents -> unit
Public Sub SaveToXml (fileName As String, package As Package, events As IDTSEvents)
参数
- fileName
- String
要保存的文件的名称。
- package
- Package
要保存的包对象。
- events
- IDTSEvents
一个 IDTSEvents 对象。
示例
以下示例使用名称 myXMLPackage.dtsx 以 XML 格式保存 .dtsx 包。
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);
app.SaveToXml("myXMLPackage.dtsx", p, 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)
app.SaveToXml("myXMLPackage.dtsx", p, Nothing)
End Sub
注解
包文件通常扩展名为 .dtsx。
如果参数中指定的 fileName
文件名不存在,则会创建它。