Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 1: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

Could you please try with that

C#
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)
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900