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?

eg.

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. :-)

Recommended Answers

All 2 Replies

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.