有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java表更新没有发生

以下是代码:

PreparedStatement preparedStatement = conn.prepareStatement("update DateDeletion set DeletionDate= ? ,userName= ? where LedgerName='MiscelleniousExpenses'");
            preparedStatement.setString(1,Deletiondate);
            preparedStatement.setString(2,userName);
            //preparedStatement.setTimestamp(3,null);
            //preparedStatement.setString(4,"MiscelleniousExpenses");
            System.out.println("date :"+Deletiondate+"username :"+userName+"ts :"+timeStamp);
            int rowsUpdated= preparedStatement.executeUpdate();//for insert statement
            System.out.println(rowsUpdated);
            conn.close();
            if(rowsUpdated>0){
                System.out.println ("Ok."); 
                //ExpenditureMasterBeanInit();
                return "updated";
            }

rowsupdated正在更新0行。。。。。当我检查 '从日期删除中选择删除日期,其中LedgerName='MiscellionUseExpenses'; 这给了我一个价值,有什么不对的吗


共 (1) 个答案

  1. # 1 楼答案

    我已插入记录,但未提交。这就是为什么在jsf页面中没有使用JDBC来获取数据。我真傻