1

In my package, I have an Execute Sql Task that sets the result set to a User variable. I then have a c# script task that needs to reference this User variable as a result set. I need the entire result set sent into my script tasks as the web service I am calling needs the entire result set in one shot.

This is the current code I am testing with. It isn't much as I am still trying to figure out where to go with it.

Any help with this is greatly appreciated

public void Main()
{
    Variable resultSet = Dts.Variables["User::ZBatch_Order_Export_ResultSet"];

    Dts.TaskResult = (int)ScriptResults.Success;
}

This is the update working code:

public void Main()
{
    DataTable dt = new DataTable();
    OleDbDataAdapter oleDa = new OleDbDataAdapter();

    oleDa.Fill(dt, Dts.Variables["User::ZBatch_Order_Export_ResultSet"].Value);

    foreach (DataRow row in dt.Rows)
    {
        Dts.Events
           .FireError(0, "ZBatch - Script Task", row["orderDate"]
           .ToString(), String.Empty, 0);
        // Do some Webservice magic
    }

    Dts.TaskResult = (int)ScriptResults.Success;
}
0

1 Answer 1

2

So very close, to access the Value of a variable, you need to hit that property

public void Main()
{
    Variable resultSet = Dts.Variables["User::ZBatch_Order_Export_ResultSet"].Value;

    // do stuff here with resultSet and the webservice

    Dts.TaskResult = (int)ScriptResults.Success;


}
Sign up to request clarification or add additional context in comments.

1 Comment

You hit the nail on the head, I was not using .Value. I have updated my code to show how I did this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.