954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

jsp code to send values to database

i have a small problem in the jsp code i have written "to send the data from form to database".
The table in the database has a primary key field whose values must be generated automatically.
so, i have created a sequence named t_seq and have written it like this:

String s = insert into tr values(t_seq.nextval,.........)
but the data isn't getting inserted

vasudha k
Newbie Poster
17 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

Would you mind post rest of the code? As from that one line we can't find anything

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

That's illegal SQL if you want to set only a subset of the fields (which you want, as you aren't setting the PK field).
You have to supply the actual fields you're setting as well, and in the correct order.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

thank you,
my code is working now.
There was a small problem in one filed which wasn't being inserted properly.

vasudha k
Newbie Poster
17 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You