Unfortunately that is not enough data for me to debug as I cannot see all of your script and the settings of each activity.
The loop dataset must be preceded by an Execute Script activity that names the result set variable. You can also set the row count variable here to confirm there are rows in this result set. Then the loop data activity needs to be set to that result set variable. Then for each row you need to deference the column to set the variable.
Take a look at this posting. There is a screen shot and steps on this.
If it doesn’t seem obvious what is occurring, then zip up all of your files you are using, (automation script and dependant query files, etc ) and send to me at firstname.lastname@example.org. I won’t be able to execute your queries but I will be able to see all the attributes of the scripts.