wood burning stoves*
The moose likes JDBC and the fly likes Error in insert into Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error in insert into" Watch "Error in insert into" New topic
Author

Error in insert into

Sals Hamid
Greenhorn

Joined: Jan 04, 2002
Posts: 24
Here is the code:

jsp error: internal servlet error. Syntax error in insert into
I check this code and other code many time but i found no problem but there is problem.Plz help
[ Edited by Dave to add code tags and fix UBB smilies ]
[ February 10, 2002: Message edited by: David O'Meara ]

No Path of Flowers lead to glory
Sean Richards
Greenhorn

Joined: Feb 02, 2002
Posts: 8
in your code you have:
pstm=conn.prepareStatement("INSERT INTO StudentBasic(Name,Address,E-mail,Password,Class) VALUES (???)");

Try using:
PreparedStatment pstm = conn.prepareStatement("INSERT INTO StudentBasic(Name,Address,E-mail,Password,Class) VALUES (?,?,?,?,?)");
This should work.
Sals Hamid
Greenhorn

Joined: Jan 04, 2002
Posts: 24
My problem is still not solved???
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Originally posted by Sals Hamid:
My problem is still not solved???

Are you sure you need a prepared statement? Try it by using statement1.executeUpdate() and compile your SQL string and show that in the error message, along with what sort of exception it was (SQLException?)
Adam


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Sals Hamid
Greenhorn

Joined: Jan 04, 2002
Posts: 24
Here is the error
javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Sals Hamid
Greenhorn

Joined: Jan 04, 2002
Posts: 24
can u tell me that syntax of insert into is right or wrong
Francois Bourgault
Ranch Hand

Joined: Oct 30, 2001
Posts: 67
VALUES should be declared like this:
VALUES (?,?,?,?,?)
The insert statement is fine, my guess the problem is with the VALUES statement. There's no
',' between each '?'
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in insert into