SSIS : loading data from recordSet (variable :object) by Script task

  • Hi,

    i was trying to get data from a recordSet variable. but it's not working :ermm:

    Code :

    public void Main()

    {

    OleDbDataAdapter A = new OleDbDataAdapter();

    System.Data.DataTable dt = new System.Data.DataTable();

    A.Fill(dt, Dts.Variables["User::Var1"].Value);

    // TODO: Add your code here

    foreach (DataRow row in dt.Rows)

    {

    string DeviceID;

    object[] array = row.ItemArray;

    DeviceID = array[0].ToString();

    // I Declare both variables ID And Name as String, So I can show in Messagebox. You can Declare ID as INT and set the value and use

    //However you want to use.

    MessageBox.Show("ID Value=" + DeviceID);

    }

    Dts.TaskResult = (int)ScriptResults.Success;

    }

  • Two different approaches presented in these articles:

    SSIS 101: Object Variables, ResultSets, and Foreach Loop Containers[/url]

    SSIS Design Pattern - Read a DataSet From Variable In a Script Task

    If these approaches don't meet your need, try searching for 'SSIS shredding a recordset' or 'SSIS shredding an object'.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply