hello everybody,
i am using java as front end and ms access as back-end for my mini project,
in my database, in couple of the tables there is field which i've declared primary key for those respective tables and which has type of autonumber.
so my question is, while inserting data to these tables the values for the primary keys (which is autonumber), whether i need to give it explicitely or database takes care itself?


ResultSet res1 = stat1.executeQuery ("insert into client values (<autonumber>,'joker','Miraj',110)" );

like in this example, first field is primary key and has a type autonumber. i feel this no. increments automatically for every new insertion of record? and if yes in java code what should i supposed to provide at that place?
If i don't provide any value there assuming that DB takes or increments the value there, there comes an error.

i hope i've put my question so that 1 can understand it....

plzz help me to clear my doubt.... thank you. :-)

5 Years
Discussion Span
Last Post by Dhanesh10
ResultSet res1 = stat1.executeQuery ("insert into client (column names) values ('joker','Miraj',110)" );

Auto Number generated Automatically , insert row directly. MENTION column name in which you want to insert data.


thanks buddy for your quick reply!!! :-)
that's why i lovve this forum than any other...

This question has already been answered. 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.