Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding new values to a table in MS Access

 
Matthew Gaunt
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There,
Am using a MS Access database to hold data, and want to add to one of the tables using JDBC.
Under most circustances, this is not a problem.
The question is, how do I add data to a table which has an AutoNumber field as the primary key??
Best Regards
Matt Gaunt
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried it with JDBC, but the SQL Statement would look something like this:

Since you have an autonumber, you have to list all of the fields that are going to be inserted. You don't include the autonumber since, well it is auto.
Bill
 
What are you doing? You are supposed to be reading 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!