mysql - 为什么我的数据库没有更新?(使用netbeans xampp mysql)
问题描述
当我运行文件时,它接受查询并说更新成功但是当我检查我的数据库时为什么它没有更新?
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();}
}
}
解决方案
推荐阅读
- tsql - SQL Server:优化器智能,在 UNION ALL 查询中的同一个表上有多个索引
- r - 提取“。”之前的字符 在包含两个“。”的字符串中
- azure - 将 Azure 文件的文件夹挂载到 Kubernetes 中?
- ms-access - 如何在 Visual Basic 2017 中获取访问字段属性
- java - 如何在 Java 代码中折叠/展开 Eclipse 资源树(项目资源管理器)?
- dart - 在 TabBarView 中预加载选项卡
- python - 无法安装 apache superset ubuntu 18.04 甚至 ubuntu 16.04
- django - 我的 django 项目中不存在的 url 错误
- javascript - 使用 d3.nest 使用 javascript 为力有向图提取值
- c - 查找整数数组中的最小元素