它说如果我把它输入到sql plus中,只是添加了;它完美地运作。我做错了什么?
Statement statement = connection.createStatement();
statement.executeUpdate("delete from aplbuk MODEL = '"+ textField_4.getText() + "'AND year = '" + textField_1.getText() + "' AND Litres = '" + textField_2.getText()
+ "' AND ENGINE_TYPE = '" + textField_3.getText() + "'");
statement.close();
答案 0 :(得分:2)
where
中的表名aplbuk
后,缺少关键字delete from aplbuk MODEL
。
将查询更新为:
statement.executeUpdate("delete from aplbuk where MODEL = '"+
textField_4.getText() + "'AND year = '" +
textField_1.getText() + "' AND Litres = '" +
textField_2.getText() + "' AND ENGINE_TYPE = '" +
textField_3.getText() + "'");
如果year
和Litres
是数字字段,则不要将该值括在单引号中。