Results 1 to 4 of 4

Thread: Query MySQL

  1. #1
    boss is offline Member
    Join Date
    Jan 2010
    Posts
    12
    Rep Power
    0

    Default Query MySQL

    How do I make this work?

    ("UPDATE Contas SET Saldo = Saldo -" + valor + "WHERE Codigo =" + cod);


    Thanx,

    Hugo

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,311
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by boss View Post
    How do I make this work?

    ("UPDATE Contas SET Saldo = Saldo -" + valor + "WHERE Codigo =" + cod);


    Thanx,

    Hugo
    Better use a PreparedStatement so you don't have to fiddle with the exact layout of the query itself. The way you're going will always be a mess and very prone to SQL injection (you don't want that, trust me).

    kind regards,

    Jos

  3. #3
    boss is offline Member
    Join Date
    Jan 2010
    Posts
    12
    Rep Power
    0

    Default

    Ok, thanx...

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,758
    Rep Power
    19

    Default

    And I should have read this thread before replying to the other one...:)

Similar Threads

  1. Query MySQL
    By boss in forum Advanced Java
    Replies: 3
    Last Post: 01-04-2010, 09:35 AM
  2. mysql query performance issue
    By gilbertsavier in forum JDBC
    Replies: 0
    Last Post: 08-05-2009, 10:34 AM
  3. MySQL/JDBC Mysql query output
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-13-2009, 01:57 AM
  4. MySQL/JDBC Prepared Statement Select query
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-12-2009, 05:29 PM
  5. Mysql/JDBC update query problem
    By thelinuxguy in forum Advanced Java
    Replies: 3
    Last Post: 02-11-2009, 09:56 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
  •