Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Foreach object enumerator question
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

96 Posts

Posted - 11/15/2013 :  13:14:28  Show Profile  Reply with Quote
I am using PragmaticWorks TaskFactory's SFTP task in SSIS to get a list of all the files on SFTP server in an object variable. I am trying to see the received list in a script task using C#'s messagebox with the following code:

System.Data.OleDb.OleDbDataAdapter A = new System.Data.OleDb.OleDbDataAdapter();

System.Data.DataTable dt = new System.Data.DataTable();
A.Fill(dt, Dts.Variables["FileList"].Value);

foreach (DataRow row in dt.Rows)

string Name;
object[] array = row.ItemArray;

Name = array[0].ToString();

MessageBox.Show("File Name= "
+ Name);

I have imported oledb library as well..but when I run the package I am getting a big ass exception at line
A.Fill(dt, Dts.Variables["FileList"].Value);

I am saying that because, before the exception, 'HI' message is getting displayed in a messagebox.

Can anyone please help me out here..Thanks a lot in advance.

Yak Posting Veteran

96 Posts

Posted - 11/15/2013 :  13:17:17  Show Profile  Reply with Quote
Edit. Here is the exception:

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 11/16/2013 :  01:08:20  Show Profile  Reply with Quote
I dont know much about Task Factory task. This is how I did it using script task.

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000