even it is really OT: you inserted thePrice as a VARCHAR type. maybe it is a NUMBER, but if it a VARCHAR then you have to "update parkingprice set price = '"+thePrice+"'" -----Ursprungliche Nachricht----- Von: Scott Walter [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 13. Marz 2001 01:37 An: [EMAIL PROTECTED] Betreff: Re: Simple SQL Statement..... Looks to me you are trying to update the price field with the literal "thePrice", move "thePrice" outside your double quotes such as: String query = "UPDATE parkingPrice SET Price = " + thePrice; --- Mick Sullivan <[EMAIL PROTECTED]> wrote: > Hi, > Does anyone know why this statement WILL ADD a value > to a record (Price)in a > database named parkingPrice: > Statement statement = connection.createStatement(); > String query = "INSERT INTO parkingPrice(" + > " Price " + > ") VALUES ('" + > thePrice + > "')"; > System.out.println("query "+ query); > statement.executeQuery( query ); > > but this statement WILL NOT UPDATE the record Price: > Statement statement = connection.createStatement(); > String query = "UPDATE parkingPrice SET > Price = thePrice"; > System.out.println("query "+ query); > > statement.executeUpdate( query ); > > The Variable thePrice is got using this function > public void setPrice( String price ) { > thePrice = price; > } > > It works for INSERT but not UPDATE???? > Also my table has only 1 value , being Price(1 row > and 1 column). > I do not want to INSERT, I just want to UPDATE the > single value. > > Anyone at all with any ideas??? > Thanks in advance, Mick > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, email: > [EMAIL PROTECTED] > ===== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Scott __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]