sqlExecute statement not running full iteration of loop

I have a list of numbers formatted as such: ######_#######.
These are populated via a text box and then displayed in a list box.

Upon hitting a submit button, all of the values are stored in an array and are supposed to be run through an sqlExecute statement.

Here is what I have: (This is the action event handler of the button)

Dim sampleid as String
dim results() as String
for i as integer = 0 to lstboxIDS.ListCount - 1
    sampleid = lstboxIDS.Cell(i, 0)

sqlUpdate = "UPDATE *tablename* SET racknumber = " + 
finalRackName.SQLQuote + " WHERE sampleid = " + sampleid.SQLQuote

If mDB.Connect then
    mIsConnected = true
    mDB.SQLExecute("SET NAMES 'utf8'")

    for each sample as string in results
        //update DB

            if mDB.Error then
                MsgBox("Error: " + mDB.ErrorMessage)
            end if
    mIsConnected = false
    msgBox("Connection error: " + mDB.ErrorMessage)
end if

I’ve stepped through the code in the debugger and each time through the for loop it grabs the same number, whether there are 3 or 15 numbers. And that is the only number that gets properly updated in the table.
The message box will show each and every number in the array, however.
I’m stumped!

You use ‘sampled’ in the sqlUpdate statement but ‘sample’ in the for each loop.

The way I read this code you’ll update the same record in the database multiple times & it will always be the last row in your listbox.

You are not updating your sqlUpdate string inside the loop.

ding ding ding! Always great to have an extra set of eyes. Thanks @Wayne_Golding!