*
The moose likes JDBC and the fly likes Update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Update" Watch "Update" New topic
Author

Update

Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
Would you help me please find what is wrong with that?

query = "UPDATE caregiver SET" +
"(sex, firstname, lastname)" +
" VALUES(?,?,?)" +
" WHERE id = ?";
PreparedStatement preparedStatement= databaseConnection.prepareStatement( query );
preparedStatement.clearParameters();
preparedStatement.setString( 1, fields.sex.getText());
preparedStatement.setString( 2, fields.firstName.getText() );
preparedStatement.setString( 3, fields.lastName.getText() );
preparedStat
preparedStatement.setString( 4, fields.id.getText() );

result = preparedStatement.executeUpdate();
Claudio Gualberto
Ranch Hand

Joined: Oct 13, 2002
Posts: 47
Nothing is wrong to me. You better post the error message from the SQLException it's generating, thus we can help you easer.
[]'s
Claudio Gualberto.
Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
Thanks
I got General error
sandesh bangera
Greenhorn

Joined: Nov 13, 2002
Posts: 12
Assuming you are usnig Oracle, then the update syntax is wrong.
sql> update <tablename> set
column1 = <updatedvalue>,
column2 = <updatedvalue>
where <condition>
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I agree with Sandesh, except for all databases, not just Oracle.
Jamie
 
Don't get me started about those stupid light bulbs.
 
subject: Update
 
Similar Threads
java.sql.SQLException: ORA-01008: not all variables bound
converting the date/time fields into Strings
Problem with CMT on Stateless Session beans
Integration test on JDBC (No Hibernate !) and Spring AbstractTransactionalJUnit4SpringContextTests
PreparedStatement