慕姐4208626
包从 SQL 导出到文件的示例代码。using Microsoft.SqlServer.Dts.Runtime;public void pkgExtract() { // ... Application app = new Application(); var events = new PackageEvents(); Package package = app.LoadFromSqlServer(packageName, server, etl.UserName, etl.Password, events); // ... string Package_File = @"C:\\Temp\ExportPkg.dtsx" app.SaveToXml(Package_File, package, null);}对于反向 - 您可以使用LoadPackage和SaveToSQLServer方法。