I'm using JDBC to execute "select customer_name from customer where customer_num = ? " in database by calling prepareStatement->setInt(1,n)->executeQuery->getString.
But the result is correct for the first attempt only. When I using a for-loop to change variable n and all of the results will become the same as the first record I retrieved! Please give me some advice on how to use prepareStatement correctly! Thank you for your help!