I am trying to solve a problem of my code. In the following code, it contains JComboBox which have a list of month. When I click on January, I want to show all the details of that month.
private void jComboBox1_MonthsActionPerformed(java.awt.event.ActionEvent evt) {
String selection = (String)jComboBox1_Months.getSelectedItem();
if(selection.equals("January")){
try{
String sql = "select * from booking where Date = ??/01/??"; //problem
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
viewBookingTable.setModel(DbUtils.resultSetToTableModel(rs));
} catch(Exception e){
}
}
}
The format for the Date is 12/01/16 in the Database with type CHAR.
Please help. Thank you very much in advance.