如何获得自增长主键表中新插入行的主键?

来源:互联网 时间:1970-01-01

Statement stmt = conn.createStatement();stmt.executeUpdate(anInsertSQL, Statement.RETURN_GENERATED_KEYS);ResultSet rs = stmt.getGeneratedKeys();if (rs.next()) { key = rs.getInt(1);}

参考自java doc by examples



相关阅读:
Top