Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Roswell123
Starting Member
1 Post |
Posted - 2010-06-30 : 10:08:14
|
Hi All,I am trying to execute SSIS package from the .net Framework.I have a User Variable available in my SSIS package to dynamically pass file name to the flat file source.Package executes successfully If i ignore Variable passing part from my code. But If I set variable in my code and then execute the package, it gets failed.I am getting the following error:"The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created."Below is my code:Microsoft.SqlServer.Dts.Runtime.Application app=new Microsoft.SqlServer.Dts.Runtime.Application();Package pkgIn = new Package();string pkgLocation;DTSExecResult pkgResults;pkgLocation =@"c:\Package1.dtsx";pkgIn.Variables["FileName"].Value = @"c:\filename.txt";pkgIn = app.LoadPackage(pkgLocation, null);pkgResults = pkgIn.Execute();MessageBox.Show(pkgResults.ToString());FYI : I have created User Variable in my package and it executes without any error if i run a package from the BIDS.Thanks in advance!!! |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|