• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Update

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
I got General error
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Sandesh, except for all databases, not just Oracle.
Jamie
 
I don't always make ads but when I do they're tiny
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic