0
我從Java應用程序運行數據庫查詢。數據轉換錯誤H2數據庫
String id = app.getVariable("Product Id"),
name = app.getVariable("Product Name"),
rate = app.getVariable("Rate"),
type = app.getVariable("Type"),
desc = app.getVariable("Description"),
qty = app.getVariable("Quantity"); // Returns String from TextFields
type = type.equalsIgnoreCase("LIMITED") ? "TRUE" : "FALSE";
try {
String query = "UPDATE COUNTER.PRODUCTS SET TITLE = ? AND RATE = ? AND IS_LIMITED = ? AND DESCRIPTION = ? WHERE ID = ?";
PreparedStatement stmt = MainApp.getConnection().prepareStatement(query);
stmt.setString(1, name);
stmt.setDouble(2, Double.parseDouble(rate));
stmt.setBoolean(3, Boolean.parseBoolean(type));
stmt.setString(4, desc);
stmt.setInt(5, Integer.parseInt(id));
stmt.executeUpdate();
} catch(Exception ex1){
System.out.println(ex1.toString());
}
但是的SQLException遇到
org.h2.jdbc.JdbcSQLException:數據轉換誤差變換 「掃描」; SQL語句:
UPDATE COUNTER.PRODUCTS SET TITLE =? AND RATE =? AND IS_LIMITED =? AND DESCRIPTION =? WHERE ID =? [22018-187]
插入數據查詢工作正常,但我無法執行更新查詢。
http://h2database.com/html/grammar.html#update –