-1

它说当我将它输入到 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();
4

1 回答 1

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() + "'");

此外,如果yearLitres是数字字段,则不要将值括在单引号中。

于 2012-12-01T04:53:01.377 回答