• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use PreparedStatement with Auto_Increment

 
Tarun Oohri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone
I am facing problem to use prepared statement with auto increment primary key. How should we insert values in such table ? Say i have 2 columns where "id" is int type, primary key, not null & auto increment. How should i enter the values in the name column which is of varchar type ?

Thanks !!!
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the "id" is primary key and auto-increment, why do you need to specify it in your code? If you do specify the id then it's not really auto-increment.

 
Attractive, successful people love this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!