Boa tarde.
private String accountLookup(String nome){
Connection con = null;
Statement st = null;
StringBuffer msgb = new StringBuffer("");
try{
//aqui vai a configuração do driver do BD
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "ocanema", "postgres");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT nome FROM act WHERE nome like '" + nome + "%'");
if (rs.next())
return rs.getString("nome") + "|";
else
return null;
}
catch (Exception e){
return e.toString();
}
}
Eu queria que continuase imprimindo os resultados da consulta enquanto tivesse nomes com o parametro escolhido alí.. não sei as funções da classe ResultSet alguem poderia me dar um auxílio?
Obrigado!