Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Foreach object enumerator question

$
0
0

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.

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


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>