当我运行文件时,它接受查询并说updatesuccess,但当我检查数据库时,为什么它不更新?
private void btnUpdateDeleteActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(radioUpdate.isSelected()){
try{
Class.forName("com.mysql.jdbc.Driver");
cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/soften?zeroDateTimeBehavior=convertToNull","root","");
st=cn.createStatement();
String sql="UPDATE `tblproductssales` SET "
+" product = ?,quantity = ?"
+" WHERE 'sale no' = ?";
PreparedStatement pst = cn.prepareStatement(sql);
pst.setString(1,editProduct.getText());
pst.setString(2,editQty.getText());
pst.setString(3,editSaleID.getText());
pst.executeUpdate();
JOptionPane.showMessageDialog(null,"success update");
//**when i run the file this JOPtionpPane shows
}catch(Exception e){e.printStackTrace();}
}
}
这是我的数据库,表名是tblproductssales
暂无答案!
目前还没有任何答案,快来回答吧!