您好,我的程序中出现此错误,但我找不到解决方案。这是我的代码,请跟随我:
private void bt2ActionPerformed(java.awt.event.ActionEvent evt) {
try{
if (JOptionPane.showConfirmDialog(null,"confirmer la modification ","modification sur un departement",
JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
st.execute("Update departement set code_departement = '"+txtcode.getText()+"',nom_departement = '"+txtnom.getText()
+"',date_acd = '"+jdat.getDateFormatString()+"' where code_departement = "+txtcode.getText());
AfficherDepartement();
}
} catch(Exception e) {JOptionPane.showMessageDialog(null,"erreur de modifier le departement !!!!\n"+e.getMessage());
System.err.println(e);}
最佳答案
在设置为查询之前,将日期格式化为'yyyy-MM-dd'。 您可以使用它
java.text.SimpleDateFormat
类。
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(new Date());
关于java - 数据截断: incorrect data value : 'yyyy MMM d' for column 'date_acd' at row 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37850554/