Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/03/2009, 05:22
monsas
 
Fecha de Ingreso: febrero-2009
Mensajes: 8
Antigüedad: 15 años, 3 meses
Puntos: 0
Pregunta Select sencilla

Hola a todos!

tengo un problema al realizar una select sencilla yo realizo esta función, pero hay una cosa que no sé como hacer ¿Como tengo que poner en el return para que me devuelva el numero de cuenta que devuelve la select?
No tengo ni idea de como se hace, estoy un poco perdida.

Muchas gracias

public long findNum_cuenta(long id_socio, Connection con) throws TitularException{
PreparedStatement stmt = null;
ResultSet rs = null;
try {
final String SQLSTATEMENT = "Select num_cuenta from titular where id_socio = ? ";
stmt=con.prepareStatement(SQLSTATEMENT);
stmt.setLong(1, id_socio);
rs = stmt.executeQuery();
return rs.getLong("num_cuenta");
}
catch (SQLException sqle) {
throw new TitularException(sqle);
}
catch(Exception e){throw new TitularException(e);}
finally {}
}