Your VB program should create a one-column text file of all the id's.

Use BULK INSERT to load them into a STAGING TABLE - a temp table for instance.

Then update your production database all in one shot!

Code:
Update ProductionTable Set HasImage=1
     From #TempTable TT
     Left Join ProductionTable PT on PT.ProductId=TT.ProductId