How to set or assign the dataset values to the Variable in Script TASK

  • Here is my code below

    int counter = 0;

    string line;

    System.IO.StreamReader reader =

    new System.IO.StreamReader(@"S:\Data\TestFile1.csv");

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

    System.Data.DataSet dslist = new System.Data.DataSet();

    while (!reader.EndOfStream)

    {

    var line1 = reader.ReadLine();

    string [] values = line1.Split(';');

    if (qlist.Columns.Count == 0)

    {

    foreach (string col in values)

    {

    DataColumn cols = new DataColumn(col.Trim(), typeof(string));

    qlist.Columns.Add(cols);

    }

    }

    else if (qlist.Columns.Count > 0)

    {

    var list = qlist.NewRow();

    list["Filename"] = values[0].ToString();

    list["Query"] = values[1].ToString();

    qlist.Rows.Add(list);

    }

    }

    dslist.Tables.Add(qlist);

    My output variable is object type

    DTS.variable["output"].values = dslist.Tables.Add(qlist);

    if add the dateset to the variable i get the error , is there any way we can dataset to the variable

    plz help me .

  • Quick thought and if I remember correctly, use ODATaskParams.Fill to populate the object type variable

    😎

  • i fixed the issue , i have use same varaible name in both parmater and inside the ssis variable that was causing the issue i changed the variable name and work fine i can assign the dataset to the output variable

    Thank you

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

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