Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/06/2010, 07:10
Avatar de Nekeniehl
Nekeniehl
 
Fecha de Ingreso: julio-2009
Ubicación: Berlin, Alemania / Granada, España
Mensajes: 132
Antigüedad: 14 años, 10 meses
Puntos: 6
Respuesta: Ultimo autoincrement dado, pero cuando no hay registros..

Por cierto..Pongo el código que estaba programando en java, por si alguien tiene esta duda también, por cierto, la CONSTANTE sirve también para php..


Código Java:
Ver original
  1. sentencia = (Statement) conexion.createStatement();
  2. sentencia.executeUpdate(sql, sentencia.RETURN_GENERATED_KEYS)
  3. ResultSet rs = sentencia.getGeneratedKeys();
  4. if (rs.next ()){
  5.     int id = rs.getInt(1);
  6. }
__________________
Antes de cambiar el mundo...dá tres vueltas por tu casa

Usa Google es tu amigo ;)