Help me: i am trying to populate data from sql database with the selected date from jdatechooser only i.e showing data from database of date 2017-08-30 only.
Here is the code:
public void actionPerformed(ActionEvent e)
{
try
{
Date date = jDate.getDate();
String query = " Select *from Transactions WHERE Month(transaction_date) = Month('"+date+"') ";
PreparedStatement pst = con.prepareStatement(query);
//pst.setDate(1,sqlchooser); CONVERT(char(10), transaction_date ,126)=CONVERT(char(10), getdate(),126);";
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
}
catch (Exception e1){
e1.printStackTrace();
}
}
Error:
java.lang.NullPointerException