SSIS Script Component Does Not Recognize Dts.Variables Namespace

340 Views Asked by At

I want to read the rows inside a user object, but when I try to fill it to a DataTable, Dts.Variables is not a recognized namespace.

public override void PreExecute()
{
    base.PreExecute();

    DataTable dt = new DataTable();
    OleDbDataAdapter adapter = new OleDbDataAdapter();
    adapter.Fill(dt, Dts.Variables["User::CRMDataSet"].Value);

    foreach (DataRow row in dt.Rows)
    {
        //insert what you want to do here
    }
}

The available namespaces are not related as well.

enter image description here

May I know how can I resolve this?

1

There are 1 best solutions below

0
ReshaRoshla On BEST ANSWER

check on your variables that you have created and the scope is the right one: either package or the script task name. Also what is your data type: if you have table data then it should be object.

Example:

image variables