Link to home
Start Free TrialLog in
Avatar of bitolexus
bitolexus

asked on

Executing SSIS FROM c#

I have an ssis package that uses a dtscofing file it imports data from a csv file to a sql server table. It works fine when run from Business Intelligence studio. When I call it from C# it fails. I have spend hours debug this code and no progress. Here sample code:

Configuration.ProductConfiguration config = new ProductConfiguration();
                Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
                Package package = app.LoadPackage(ProductConfiguration.UpdateSkuSSIS, null);
                package.ImportConfigurationFile(ProductConfiguration.UpdateSkuConfigFile);
                DTSExecResult result = package.Execute();

Please help!!!
Avatar of carsRST
carsRST
Flag of United States of America image

See this link.  It will walk you step by step.  

http://www.codeproject.com/KB/database/CallSSISFromCSharp.aspx
Avatar of bitolexus
bitolexus

ASKER

My code is doing something similar. My dtsConfig and dtsx locations are coming from the app.config. I exported all user variables into the dtsconfig. I am assuming they should be automatically loaded . Its really annoying BI studio execute the same package without problem. One I should let you know is that I renamed the package but I don't think that is an issue.
If you take out the config file and hard code the variables in, does it work?
Are you passing in variables from c# or reading from within SSIS?
There are 3 variables which hold path for csv loaction, archive folder and error folder. the value are in ssis. my package has a dtsconfig which holds the same values. I am passing dtsx file location and dtsconfig file location from C#. I have tried to invoke validate method of the Package before invoking execute and it returns success.
Is there error in c# or in SSIS?  Do you have an SSIS error log you can post?
no error in ssis, c# returns enum DTSExecResult.Failure
Your best bet is to set logging and see exactly what is happening when you run via c#.
http://msdn.microsoft.com/en-us/library/ms141212.aspx

If you can post the log, then Pedro and I may be able to assist what the issue is.
Here is my log file
log.txt
It looks as if you need to install all of SSIS on the work station running your c# code.  My guess is you do that install and your package should run fine from your app.
ASKER CERTIFIED SOLUTION
Avatar of ill
ill
Flag of Slovakia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
u r correct