File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use PreparedStatement with Auto_Increment

 
Tarun Oohri
Ranch Hand
Posts: 189
  • 0
  • 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: 3222
12
Android Java
  • 0
  • 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.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic