Q for TimYates/Ken/kludeep
Posted on 2003-11-27
I am following ChainReaction's q previously and i fee curious and try it out my own. Yet, i found the same error like he did... and it's not good for me to tap into his question.. hope 3 of us can help me as well...
I have create the same DB he have, Access, with Date(InsDateA) and datatye is date.
this is my code:
PreparedStatement ps = conn.prepareStatement( "SELECT * FROM PURCHASE WHERE "+
" (ExpDateA > ? AND ExpDateA < ?)" ) ;
ps.setDate( 1, new java.sql.Date( sdf.parse( startdate ).getTime() ) );
ps.setDate( 2, new java.sql.Date( sdf.parse( enddate ).getTime() ) );
out.println(counter + ":"+ rs.getString("Customer") + vf.format(rs.getDate("ExpDateA")));
this is the rawdata.
And this is my result page:
Start Date : 01/11/2003 End Date : 30/11/2003
ha.. the first data shouldnt come out.. but i couldn't notice what went wrong... i did try whay TimeYates explain to Chainreaction, but i think i have the same problem with him... :-)
if i change the query again...
Start Date : 01/11/2003 End Date : 15/11/2003
Again... all the the data is wrong...
Can guide me as well?