如何在JavaFX中将listview项传输到java数据库?

如何在JavaFX中将listview项传输到java数据库?,java,listview,jdbc,javafx,netbeans-8,Java,Listview,Jdbc,Javafx,Netbeans 8,我在使用javaFX将listview项从listview传输到netbeans上的SQL数据库时遇到问题 单击按钮将项目添加到数据库的listView(添加顺序)时,将调用以下方法。我需要将listview中的所有项写入一列 private static void insertColl(){ try{ stmt = conn1.createStatement(); String description = listView.getText();

我在使用javaFX将listview项从listview传输到netbeans上的SQL数据库时遇到问题

单击按钮将项目添加到数据库的listView(添加顺序)时,将调用以下方法。我需要将listview中的所有项写入一列

 private static void insertColl(){
    try{
        stmt = conn1.createStatement();
        String description = listView.getText();
        String query = " insert into ORDERS(DESCRIPTION)"
        + " values (?)";

    PreparedStatement preparedStmt = conn1.prepareStatement(query);

    preparedStmt.execute();
        stmt.close();
    }
    catch (SQLException sqlExcept){
        sqlExcept.printStackTrace();
    }
下面是我们的javafx项目的外观,所讨论的listview旁边有一个箭头。
抱歉,如果我没有使用正确的术语,因为我是新手。谢谢你的帮助。

我认为你误解了准备好的报表是如何工作的,你应该为您的报表设置参数

PreparedStatement preparedStmt = conn1.prepareStatement(query);
preparedStmt.setString(1, description );//<-------------------
PreparedStatement preparedStmt=conn1.prepareStatement(查询);

准备好的STMT.setString(1,说明)// 您没有将值添加到PreparedStatement,并尝试使用executeUpdate()

另外,您没有使用第一条语句

PreparedStatement preparedStmt=conexion.getConexion().prepareStatement(query);

preparedStmt.setString(1, description);

preparedStmt.executeUpdate();

你能把你的错误贴出来吗?