我想在两个日期之间从mysql表中查询数据,但是我的jTable显示零结果。
这是我的代码
Connection con = getConnection();
String date1 = jDate1.getDateFormatString();
String date2 = jDate2.getDateFormatString();
Statement st;
ResultSet rs;
try {
String sql = "select * from summary where _date between '"+date1+"' and '"+date2+"' ";
st = con.createStatement();
rs = st.executeQuery(sql);
summaryTable.setModel(DbUtils.resultSetToTableModel(rs));
}
catch (Exception e)
{
System.out.println(e);
}
}