| Author |
id of the new field in my table
|
Grégoire Berclaz
Greenhorn
Joined: Feb 19, 2003
Posts: 28
|
|
Hello, I insert into a table new informations. I like to know the id of this. How can I do? @+ Greg
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
What database and what driver are you using?
|
 |
Grégoire Berclaz
Greenhorn
Joined: Feb 19, 2003
Posts: 28
|
|
|
A mySQL database with a jdbc connection
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Well, you should be able to do SELECT LAST_INSERT_ID() right after your INSERT statement. Depending on your JDBC driver version you might be able to use the public int executeUpdate(String SQL, int autoGeneratedKeys) method. This only works with JDBC 3.0 specifications though. If you aren't already, I highly recomend using the Connector-J Driver. Good luck.
|
 |
Grégoire Berclaz
Greenhorn
Joined: Feb 19, 2003
Posts: 28
|
|
|
Tks!
|
 |
 |
|
|
subject: id of the new field in my table
|
|
|