-2

I have SSIS variable of type object which holds the OLE DB result set from OLE DB source.

The object is list of blogs with each blog having attributes title and description. How can I parse the SSIS object variable and iterate over each blog and then field?

EDIT :

I want to read full result set in script task.

Satishakumar Awati
  • 3,604
  • 1
  • 29
  • 50
  • 1
    Possible duplicate of [SSIS - How to access a RecordSet variable inside a Script Task](https://stackoverflow.com/questions/2596992/ssis-how-to-access-a-recordset-variable-inside-a-script-task) – Tab Alleman Jul 20 '18 at 13:12

1 Answers1

0
// this gets the data object and sets ti to a data table
            OleDbDataAdapter A = new OleDbDataAdapter();
            System.Data.DataTable dt = new System.Data.DataTable();
            A.Fill(dt, Dts.Variables["User::SSISObjectVariableFromPackage"].Value);

            // for test data
            DataTable sourceTable = dt;

            //Now loop through databale and do your processing



//----------------------------------------------------------------------
//Updated  -- possible solution to fix issue in comments but left original above as that works for most 

//try this version instead, mabye converting the SSIS variable to a C# object first, and not accessing it directly into the A.Fill may resolve your issue in the comments:

Object OBJDataTableValidFieldListFull = Dts.Variables["User::SSISObjectVariableFromPackage"].Value;

    // this gets the data object and sets ti to a data table
                OleDbDataAdapter A = new OleDbDataAdapter();
                System.Data.DataTable dt = new System.Data.DataTable();
                A.Fill(dt, OBJDataTableValidFieldListFull);

                // for test data
                DataTable sourceTable = dt;

                //Now loop through databale and do your processing
Brad
  • 3,454
  • 3
  • 27
  • 50
  • This is working for me in first script task, when I tried to use same object variable in 2nd script task, the object rows are coming as zero. Its weird and I have not modified the SSIS object variable. – Satishakumar Awati Jul 20 '18 at 16:51
  • I have not seen that issue but I have also not tried to use the same object populated object twice. Did you put it as ReadOnly when passing to the script task? – Brad Jul 20 '18 at 17:02
  • Yess I did pass it has read only variable. I tried to read in two separate script tasks. I am able read only in one either first or second if I comment but not both. In single package execution I have two linear script tasks. – Satishakumar Awati Jul 20 '18 at 19:52