![]()
Code
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
Application app = new Application();
/* 从文件运行包
IDTSPackage90 package = app.LoadPackage("c:\\ExamplePackage.dtsx", true, null);
*/
//从数据库中运行包
IDTSPackage90 package2 = app.LoadFromSQLServer("Basic Package Lesson 1", "wangdong\\sa", string.Empty, string.Empty, true,null);
package2.ImportConfigurationFile("c:\\testinstall\\Xml.dtsConfig");
DTSExecResult result2 = package2.Execute();
if (result2.Equals(DTSExecResult.DTSER_SUCCESS))
lblInfo.Text = "执行包OK";
else
{
lblInfo.Text = "执行包Failed";
return;
}