我使用dateChooserCombo1在数据库中插入数据。我使用getDataEditor,但显示错误。错误显示
**
pat.setString(14,(((JTextField)dateChooserCombo1.getDateEditor()。getUiComponent())。getText());
** 我不知道如何使它工作,所以如果有人可以帮助我,请这样做。
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String sql = "insert into Issue(Book_ID,Name,Edition,Publisher,Price,Pages,Student_ID,SName,Father,Course,Branch,Year,Semester,DateOfIssue)Values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
try {
pat = conn.prepareStatement(sql);
pat.setString(1, jTextField1.getText());
pat.setString(2, jTextField1.getText());
pat.setString(3, jTextField1.getText());
pat.setString(4, jTextField1.getText());
pat.setString(5, jTextField1.getText());
pat.setString(6, jTextField1.getText());
pat.setString(7, jTextField1.getText());
pat.setString(8, jTextField1.getText());
pat.setString(9, jTextField1.getText());
pat.setString(10, jTextField1.getText());
pat.setString(11, jTextField1.getText());
pat.setString(12, jTextField1.getText());
pat.setString(13, jTextField1.getText());
pat.setString(14, ((JTextField)dateChooserCombo1.getDateEditor().getUiComponent()).getText());
pat.execute();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}