列数が行 1 の値カウントと一致しないという SQLexception エラーが発生します。ステートメントを適切にチェックしてデータベースを変更しようとしましたが、問題を認識できませんでした。任意の提案をお願いします...
JButton btnNewButton_1 = new JButton("Save");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String PHN = textField_a.getText();
String Week1 = textField_4.getText();
String Week2 = textField_5.getText();
String Week3 = textField_6.getText();
String Week4 = textField_7.getText();
if (PHN.equals("") || (Week1.equals("") || (Week2.equals("") || (Week3.equals("") || (Week4.equals("") ))))) {
JOptionPane.showMessageDialog(frmTemplate, "Please enter values in all the fields.");
}
else {
try {
db.stmt.executeUpdate("INSERT INTO weight (PHN, Week1, Week2, Week3, Week4)"+"VALUES"+"("+"'"+PHN+"',"+"'"+Week1+"',"+"'"+Week2+"'"+"'"+Week3+"'"+"'"+Week4+"')");
JOptionPane.showMessageDialog(frmTemplate, "New Record Added");
textField_a.setText(null);
textField_4.setText(null);
textField_5.setText(null);
textField_6.setText(null);
textField_7.setText(null);
}
catch (SQLException e) {
JOptionPane.showMessageDialog(frmTemplate, "The value you have entered already exist");
e.printStackTrace();
}
}
}
});