Mick Sullivan 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


This question is very OT... (ie, nothing to do with Tomcat :()

probably you need single quotes around 'thePrice' in the UPDATE

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to