0

hi am making project..i have entered the record in 8 columns of table using jdbc and 9th column is automatically icremented as primary..so after putting the record and executin query i want to check primary no which i get..i want to show it in text box..what can be the query...??
pls reply...

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by ~s.o.s~
0

It depends on the database that you are using. Different databases have different ways of dealing with auto-incremented keys like that.

0

hi am making project..i have entered the record in 8 columns of table using jdbc and 9th column is automatically icremented as primary..so after putting the record and executin query i want to check primary no which i get..i want to show it in text box..what can be the query...??

Use the `getGeneratedKeys()` method of the statement object.

Just make sure that when executing the statement you pass in the "Statement.RETURN_GENERATED_KEYS" flag as the second parameter. Follow the instructions here and make sure that you have created a table which explicitly has a auto-incrementing column.

Edited by ~s.o.s~: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.