SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

rockstar283
Yak Posting Veteran

86 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();
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

86 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

visakh16
Very Important crosS Applying yaK Herder

India
52249 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.

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
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000