Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/10/2009, 14:55
farfar
 
Fecha de Ingreso: septiembre-2009
Mensajes: 13
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: select max(codigo) donde guarda la respuesta

Código:
public int Codigo(){
MysqlConectar conn = new MysqlConectar();
conn.connectar();
String a;
int b;
try {
conn.consulta("SELECT max(codigo) as maxcod from oferta;");


b = conn.getRs().getInt("maxcod");

if(b.next())
     return (b+1);

} catch (SQLException e) {
return -1;
}
}
Segun mis fuentes y lo que dice ahi, hay que abrir el resultSet[b.next()]

creo que este codigo te puede funcionar.

saludos