HOW TO CHECK IS OBJECT VARIABLE CONTAINS VALUE OR NOT

  • Hi There,

    Im giving an object variable as input for foreach loop.

    Value for the object variable was set by a sql task. if the obj variable is not contain any value it will through error.

    so I require to check whether an object variable contains data ?

    is there any possibility to check that in precedence constraint ?

  • Hi

    Imho you can add a Script Task between and check your object variable,

    public void Main()

    {

    OleDbDataAdapter oda = new OleDbDataAdapter();

    DataTable dtb = new DataTable();

    // read object variable

    oda.Fill(dtb, Dts.Variables["YourObjVar"].Value);

    //count rows

    Dts.Variables["RowChk"].Value = (int)(dtb.Rows.Count);

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    and set a Precedence Constraint where expression @[User::RowChk] > 0 ,

    of course, there are some other ways to do that.

    Best regards

    Mike

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

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