2009年7月20日 星期一

Java: How To Get Auto Increment Values After SQL Insert

// // Insert one row that will generate an AUTO INCREMENT // key in the primary key field // stmt.executeUpdate( "INSERT INTO autoIncTest (comment) " + "values ('How can I get the auto increment field value?')", Statement.RETURN_GENERATED_KEYS); // // Use Statement.getGeneratedKeys() // to retrieve the value(s) //

沒有留言: