File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with sql update command ->

 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • 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).]
 
prabhat kumar
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks prabhat!
That fixed my problem.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic