I dont know much about SQL in visual basic, but why not try a "For Each" statement
Example:

For Each VariableName As ObjectType In CollectionOfSomeSorts
'Code for what to do to VariableName. VariableName will = ObjectType. the 'As' arg is optional
Next


If you dont know what type of object it is, try this

For Each VariableName In CollectionInSomeSorts
'Code for what to do to VariableName. VariableName will be a String or Object (depending on the collection type)
Next