0
How can I get an Item from each Row?
For example, I have a column with the following rows:
- TEST
- TEST
- TESTE2
- TESTE2
- TESTE3
As I wished:
- TEST
- TESTE2
- TESTE3
My code:
public void carregar(){
qy = "SELECT TESTEROWS FROM COLUNA";
try {
PreparedStatement ps = MySQL.getConn().prepareStatement(qy);
ResultSet rs = ps.executeQuery();
if (rs.next()){
setItem(TypeItem.valueOf(rs.getString("Type")));
}
loadItemsLoja();
} catch (SQLException e) {
e.printStackTrace();
}
}
With while it is only returning all (obvious), with if it only returns me the first. How can I get one from each Row?