Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have the following script in my script task in control flow of my SSIS package.
C#
public void Main()
        {
            Object objFeeder = new object();
            DataTable dt = new DataTable();
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            string partNoList = "";

            adapter.Fill(dt, Dts.Variables["User::FeederLoadingListObject"].Value);

            foreach (DataRow partNo in dt.Rows) 
            {
                object[] array = partNo.ItemArray;
                partNoList = array[0].ToString();

                if (partNoList == "")
                {
                    partNoList = partNo.ToString();
                }
                else
                {
                    partNoList = partNoList + "," + partNo.ToString();
                }
                
            }

            // TODO: Add your code here
            Dts.Variables["User::PartNoList"].Value = partNoList;
            Dts.TaskResult = (int)ScriptResults.Success;
        }



The data would be passed from data flow using a RecordSet Destination component and passed into the script task in control flow. I have set a data viewer in my data flow and it indeed returns me my desired result.
But somehow when I debug the script, it shows nothing but empty list in my object which is "User::FeederLoadingListObject".

Something is weird though, it will get into the script first before showing up the windows for my data viewer. Suppose is data viewer then only steps into my script.

Any idea would be appreciated. Thank you.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900