Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update

 
Manuel Paco
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
I got General error
 
sandesh bangera
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Sandesh, except for all databases, not just Oracle.
Jamie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic