以下是代码:
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行更新..... '从Datedeletion中选择Deletiondate,其中LedgerName ='MiscelleniousExpenses'; 它给了我一个可能出错的价值?
答案 0 :(得分:0)
我已插入记录但未提交。这就是为什么数据不会在jsf页面中使用JDBC。我多么傻到。