Click here to Skip to main content
14,429,919 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi,

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();
        }


regards,
sajith
Posted
Updated 5-Sep-11 2:07am
v2
Comments
Reiss 5-Sep-11 7:57am
   
Shouldn't you be placing this type of information in to the dts configuration file?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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();


Your file Name-->Refer Your full file name
DTSXPath--> Path of your Package.dtsx i.e. (D:\SSIS\DEMO\DEMO\Package1.dtsx)
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100