在JDBC中的SQL查询中获取语法错误

时间:2017-05-08 22:34:41

标签: java sql jdbc

我收到语法错误,但我确信我正在做的一切正确。你能看看吗?

String ORDER, DROP, CAR;

            String Statement = "INSERT INTO WORKORDER"
                    + "(ORDER, DROPOFFDATE, COMPLETIONDATE) VALUES "
                    + "( ?, ?, null);";

            //JOptionPane.showMessageDialog(frame, Statement, "Daisy Imports", 3);
            try {
                PreparedStatement PST = connection.prepareStatement(Statement);
                ORDER = JOptionPane.showInputDialog("Please assign a order number for this order");
                int ORDERi = Integer.parseInt(ORDER);
                DROP = JOptionPane.showInputDialog("Please Enter the date the car was dropped off (YYYY-MM-DD)");
                CAR = JOptionPane.showInputDialog("Enter the VIN for the car this work order is for");
                PST.setInt(1, ORDERi);
                PST.setString(2, DROP);
                PST.execute();

1 个答案:

答案 0 :(得分:0)

尝试在准备好的陈述结尾处删除分号。

编辑:问题是“订购”是一个保留字。