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

来源:转载

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



分享给朋友:
您可能感兴趣的文章:
随机阅读: