Results 1 to 15 of 15
  1. #1
    sandraW is offline Member
    Join Date
    Aug 2010
    Posts
    11
    Rep Power
    0

    Question Update a price in a database

    Does anyone know the code to UPDATE a price to 200(for example).. for a particular property whose propertyId is 35 in a 'Properties' database

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Are you just looking for the SQL Syntax?

    UPDATE `Properties` SET `price`='200' WHERE `propertyId`='35'

    Not really a question for a Java forum; but there is the code regardless. You can find it explained here: MySQL :: MySQL 3.23, 4.0, 4.1 Reference Manual :: 12.2.10 UPDATE Syntax

  3. #3
    sandraW is offline Member
    Join Date
    Aug 2010
    Posts
    11
    Rep Power
    0

    Default

    Oh thank you very much, I know the Sql syntax.

    I think im looking for code like public void updateAction()
    {
    String price = price.getText();
    statement.executeUpdate(UPDATE.... etc)

    would this be correct??

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Why can people not simply look things up?
    It's not as if there isn't a perfectly good tutorial for this sort of thing...

  5. #5
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Quote Originally Posted by Tolls View Post
    Why can people not simply look things up?
    It's not as if there isn't a perfectly good tutorial for this sort of thing...
    Is the ability to remember syntax greater than the ability to know where to get it ;)

    oh people dont look things up because they are unsure of their ability to decipher good information from the dud's but of course just trying out all the code would sort that out :D

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    If you can try-out something, event it fail you can learn a lot. That's why we should encourage others to read a lot and try-out them before ask a question. Isn't it? ;)

  7. #7
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Quote Originally Posted by Eranga View Post
    If you can try-out something, event it fail you can learn a lot. That's why we should encourage others to read a lot and try-out them before ask a question. Isn't it? ;)
    we have got lost in translation again Eranga, that is exactly what I meant :)

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  9. #9
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Talking

    Quote Originally Posted by Eranga View Post
    No actually I second it, didn't you see that? :)
    It's getting late I dont see much D

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Quote Originally Posted by al_Marshy_1981 View Post
    Is the ability to remember syntax greater than the ability to know where to get it ;)

    oh people dont look things up because they are unsure of their ability to decipher good information from the dud's but of course just trying out all the code would sort that out :D
    But surely the stuff from the makers of the product should, mostly, be considered non-dud? This is what I don't understand...especially with questions like this which are essentially "teach me JDBC".

    ...and I rarely remember anything, which makes interviews entertaining!
    :)

  11. #11
    sandraW is offline Member
    Join Date
    Aug 2010
    Posts
    11
    Rep Power
    0

    Default

    you are all WRECKING MY HEAD and have been no help! whats the point of this site anyway ye cheeky sh*ts!!

    DELETE ACCOUNT:eek:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    I posted a link to the JDBC tutorials (specifically around PreparedStatements) which, had you read it, would have told you everything you needed to know.

    Did you read it?

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    You've put some effort. Only thing other members could do for you is guiding to the correct path. You had to have the responsibility to taking off or not.

  14. #14
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Quote Originally Posted by sandraW View Post
    you are all WRECKING MY HEAD and have been no help! whats the point of this site anyway ye cheeky sh*ts!!

    DELETE ACCOUNT:eek:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Want to be a programmer> learn how to gather information. not being hard or anything but especially know how to gather information when somebody lays it on your plate, or do you know what happens you wreck everybody you are working withs head!!!! good luck.

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    That's the idea of a forum, guiding them to correct path, no one here wants to write codes for other. Had to have put more and more effort, and that's the success always. :)

Similar Threads

  1. I need Sun Voucher for discount price.
    By salma in forum Java Certification
    Replies: 2
    Last Post: 01-09-2010, 02:48 AM
  2. Replies: 1
    Last Post: 12-23-2009, 01:24 AM
  3. Displaying a price with a checkbox
    By F4iChick02 in forum New To Java
    Replies: 4
    Last Post: 12-09-2008, 06:13 AM
  4. How to update database using Spring framework
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 04-01-2008, 11:43 AM
  5. How to update database using Spring framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-28-2007, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •