• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with sql update command ->

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there!
I am trying to update a table in my access database, the code in my bean for doing this is:
// Create the statement object -->
Statement statement = connection.createStatement();
// Define and execute the sql update -->
String update = "UPDATE user SET FNAME="+fName+",LNAME="+lName+",USERID="+userId+",PASSWORD="+password+" WHERE FNAME="+user;
statement.executeUpdate(update);
I get no errors so I thought everything was working just fine, but when I took a look in the database, no changes had been made... any suggestions to what is happening? Is the code above wrong?
Thanks in advance!
Regards
------------------
Dominic Steng�rd
Sun Certified Java 2 Programmer
------------------

[This message has been edited by Dominic Steng�rd (edited April 21, 2001).]
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u need to pass the string(varchar) values in quotes
like
"where fname='"+fname+"' and rest of the query like this"
hope it will help
 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks prabhat!
That fixed my problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic