DIOOOOOSSSS!!!!! que torpe he vuelto a copy pastear maaaaallll!!!!!
Si que lo tenia puesto pero me da 0
try{...
conn = DriverManager.getConnection (url, user, pass);
Statement stmt = conn.createStatement() ;
retorno=stmt.executeUpdate(query) ;
PreparedStatement SlastID = conn.prepareStatement("SELECT LAST_INSERT_ID() ");
System.out.println("LLega aqui conn ");
ResultSet lastID = SlastID.executeQuery();
System.out.println("LLega aqui resultset ");
while (lastID.next()){
questionID = lastID.getInt(1);
System.out.println("entroooo ");
}
System.out.println("LLega aqui ");
System.out.println("ulti "+ questionID);
stmt.close();
conn.close();
}catch (SQLException ex) {
System.out.println("ERROR en consulta SQL.");
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
} catch (ClassNotFoundException e){
System.out.println("error :(");
}
return retorno;
Ya no se que mirar