MySQL Forums
Forum List  »  Spanish

Ayuda con procedimiento almacenado de búsqueda
Posted by: Samuel Paredes
Date: January 22, 2017 05:40PM

Me dejaron hacer un procedimiento almacenado de una aplicación de agenda pero no me sale, el método a llamar desde NetBeans es el siguiente:

@Override
public ObservableList<Amigo> buscar(String nombres) {
Connection con = Conex.conectar();
CallableStatement cs = null;
ResultSet rs = null;
ObservableList<Amigo> lista = FXCollections.observableArrayList();
String sql = "call buscar(?)";

try {
cs = con.prepareCall(sql);
cs.setString(1, nombres);
rs = cs.executeQuery();
while(rs.next()){
lista.add(new Amigo(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getInt(6)));
}

} catch (SQLException ex) {
ex.printStackTrace();
}
return lista;
}

Los campos de la tabla son idAmigo int PK, foto varchar, nombres varchar, correo varchar, telf varchar y estado int.

Desde MySql Workbench llevo intentando hacer el SP de diferentes maneras pero no me sale, ayuda por favor! :(

Options: ReplyQuote


Subject
Views
Written By
Posted
Ayuda con procedimiento almacenado de búsqueda
1035
January 22, 2017 05:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.