Forums Register Login

how to set auto increment field value ?

+Pie Number of slices to send: Send
Hi,

This is my below code working perfectly. If i give the value for auto incremented field. But normally we should not specify any value for this auto incremented field. How i can rewrite this code?



Presently i'm not included the value for auto incremented filed. Could any one can explain me how to set the value for auto increment value. The above code showing Column count doesn't match value count at row 1..


+Pie Number of slices to send: Send
Have you tried inserting the value NULL for the the auto incremented column?
+Pie Number of slices to send: Send
Thanks.. It's working. And i have a one more doubt, I have four jsp pages. All are interacting with the Database. Presently i written the connection code in all the 4 JSP pages. Is it possible to write the connection code in a single page and utilizing in all the jsp page in the project??
+Pie Number of slices to send: Send
You should never put database code in a jsp. Very bad practice and a nightmare to maintain. In general you should avoid putting any Java code in a JSP using the JSTL or something similar instead. All the Java code should be in the Controller (Servlet, DataAccess classes and etc.). This will allow for a cleaner implementation and more code reuse.
+Pie Number of slices to send: Send
Hi,

You should create a DBConnection class, that handles all the connectiion related stuff, for example getConnection(),releaseConnection()... etc and use it in the db layer to perform database operations. And send the result of the operation to jsp page for displaying the result.

Thanks
+Pie Number of slices to send: Send
Thanks for your reply!! I understand i have to create a Database Connection class in the servlet. But what about the ResultSet and Statement Creation? For this also i can create a function in the Database Connection class or in the Jsp Page??
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4598 times.
Similar Threads
auto increment a number
counter is not shown in JTextField
synchronization
Hibernate Mapping- composite id (pk+ foreign key)
Increment Operator question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:41:40.