SQLite JavaFX INSERT进入x附近的语法错误

时间:2019-01-29 10:30:02

标签: java sqlite intellij-idea javafx javafx-8

我有一个行代码中插入许多变量到名为GoodDB数据库。由于某种原因,我无法使其正常工作并出现语法错误。

我已读取多个线程,其中我的代码为1:1,但由于某些原因,它仍然对我不起作用

public void submitButton (ActionEvent event) throws IOException{

    try {
        Connection conn = DriverManager.getConnection("jdbc:sqlite:--Location--");
        Statement statement = conn.createStatement();
        statement.executeUpdate("INSERT INTO GooDB (Date, UID, prodCode, TableNr, TableTwo, Line, Var, Comment, CommentTwo, Person, Dept, Qty) VALUES '" + dDate.getValue() + "', '" + tfuID.getText() + "', '" +
                tfprodCode.getText() + "', '" + tfTableNr.getText() + "', '" + tfLine.getText() + "', '" + tfcommentTwo.getText() + "', '" + taComm.getText() + "', '" + cbPerson.getValue() + "', '" + cbTableTwo.getValue() + "', '" +
                cbDept.getValue() + "', '" + cbQty.getValue() + "'");

        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("u good");
        alert.setHeaderText("u good");
        alert.setContentText(null);
        alert.showAndWait();

    } catch (SQLException e){
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("DB Error");
        alert.setHeaderText("DB Connection Failed");
        alert.setContentText(e.getMessage());
        alert.showAndWait();
    }
}

在进入我得到的错误消息在“捕捉”中描述的数据显示

[SQLITE_ERROR] SQL error or missing database (near "'null'": syntax error)

0 个答案:

没有答案