如何以编程方式更改DTSX设置 [英] how to change DTSX setting Programically
本文介绍了如何以编程方式更改DTSX设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
iam使用C#.net执行SSIS程序包.它工作正常
但是如果我更改了excel或过程的位置,则程序无法正常工作.那么我必须更改excel或过程的xml路径位置
在DTSX中
我如何以编程方式更改.iam附加以下代码的路径.
iam Execute SSIS Package Using C#.net .it is working fine
but if i change the excel or procedure location the programe does not work.then i have to change the xml path location of excel or procedure
in DTSX
how can i programically change the path .iam attaching the code below.
private void btnExecute_Click(object sender, EventArgs e)
{
app = new Microsoft.SqlServer.Dts.Runtime.Application();
Package package = null;
try
{
package = app.LoadPackage(txtDTSX.Text.Trim(), null);
//Execute DTSX.
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
}
问候,
sajith
regards,
sajith
推荐答案
能否请您尝试一下
Could you please try with that
Application app = new Application();
Package package = null;
package =
app.LoadPackage(@"DTSXPath.dtsx", null);
package.Connections["SourceConnectionExcel"].ConnectionString =
"provider=Microsoft.Jet.OLEDB.4.0;data source=" + Your file Name + ";Extended Properties=Excel 8.0; ";
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
您的文件名->请参考您的完整文件名
DTSXPath-> Package.dtsx的路径,即(D:\ SSIS \ DEMO \ DEMO \ Package1.dtsx)
Your file Name-->Refer Your full file name
DTSXPath--> Path of your Package.dtsx i.e. (D:\SSIS\DEMO\DEMO\Package1.dtsx)
这篇关于如何以编程方式更改DTSX设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文