On line 104 you read a row and do nothing with it (outside the while loop).
In reply to Re: SQL While loop problem. by mje in thread SQL While loop problem. by dmsparts