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.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Foreach object enumerator question

Author  Topic 

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2013-11-15 : 13:14:28
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();
MessageBox.Show("hi");
A.Fill(dt, Dts.Variables["FileList"].Value);
MessageBox.Show(dt.Rows.Count.ToString());

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.

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2013-11-15 : 13:17:17
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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

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

http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -