我在数据库中更新日期有问题,我正在使用带有Xampp数据库的(Java语言)netbeans。 (代码图片在上面的链接中)
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String a = ((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText();
String s1=jTextField1.getText();
String s2=jTextField2.getText();
String s3=jTextField3.getText();
if(s1.isEmpty() || s2.isEmpty() || s3.isEmpty() || a.isEmpty() )
{
JOptionPane.showMessageDialog(null, "Fill All Fields Before Update");
}
else
{
String query;
query = "UPDATE medicine SET price='"+s3+"',quantity='"+s2+"',Expiry Date='"+a+"' WHERE name = '"+s1+"'";
executeSQlQuery(query,"Updated");
}
}