Ae galera,
To com um probleminha aqui, que ja nao sei mais o que fazer!! heheheh
o código é o seguinte:
public String PesquisarPessoa(String nome) throws RemoteException, SQLException{
int codigo;
String nom, end, cpf , rg, tel;
String sql = "SELECT * FROM `cliente` WHERE nome like '%" + nome + "%'";
Statement stm = this.con.createStatement();
ResultSet rs = stm.executeQuery(sql);
String S = "";
codigo = rs.getInt("codigo");
nom = rs.getString("nome");
end = rs.getString("endereco");
cpf = rs.getString("cpf");
rg = rs.getString("rg");
tel = rs.getString("tel");
S = "Código: " + codigo + "\nNome: " + nome + "\nEndereco: " + end + "Cpf: " +
cpf + "RG: " + rg + "Telefone: " + tel + "\n\n";
rs.close();
return S;
}
try {
Loja_IF loja = new Loja();
memo.append( loja.PesquisarPessoa( (edtNome.getText() ) ));
} catch (RemoteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Ele está gerando as exeções:
java.sql.SQLException: Before start of result set
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:720)
at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2617)
at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2749)
at br.com.unibratec.util.Loja.PesquisarPessoa(Loja.java:123)
at br.com.unibratec.gui.PesquisarCliente.actionPerformed(PesquisarCliente.java:110)
Alguem poderia me dar uma luz?
Obrigado :lol: