Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting Auto Number

 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Currently I'm working with JSP and MSAccess , i wanna insert auto number from the jsp page, can any one give me the idea how can i do it, if you have any site reference pls give me the link,
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't insert an explicit number since it is an AutoNumber field. To insert a new row, either leave the autonumber field out of the insert clause OR set it to a value of 0. In either case, Access will automatically insert the next number.

For example, if you have table "table1" with columns: (id autonumber) and (field1 char(20)), then here are the 2 inserts you can choose from:
1. insert into table1 (field1) values ("some text") // id column left out
OR
2. insert into table1 (id, field1) values (0, "some text") // id set to 0
 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Blake
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic