creating recordset with "Execute SQL Taks" in a foreach loop

  • I have made a foreach loop in which I have an "execute SQL task" which fills a recordset stored in a variable.

    the first time the task is executed, it's ok, but on the second time, I have a violation access of memory. I tried the "dispose()" method of the variable, in vain.

    Is there anybody who meets this problem ? How can I solve it ?

    An alternative would be to store de result of the query in a table, and to explore it with a script task, but how can I get link the table to a DataTable variable ?

    Thanks for helping me !

  • Without knowing exactly what you are doing this is a bit hard, but I think you have declared your variable at the wrong scope.

    Add a sequence container to the loop container and put everything in your loop container into this sequence container. Delete your object variable and re-create it in the scope of the sequence container.

    Each time you go through the loop, the variable will be declared and then disposed.

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

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