title: Sql query in DAO class regarding
body: <p>I converted date datatype  to string and stored in table as a string.I want to write a query to show results between certain date.I wrote like this</p>
  
  <pre><code> public Statement getstatement(Statement s) throws SQLException {
          long accid=0;
          Statement s1=null;
          Connection conn=DatabaseUtil.getConnection();
          PreparedStatement psmt=conn.prepareStatement("select * from Account_groupc_tja05 where Account_id =?");
          psmt.setLong(1,s.getAccid());
          System.out.println("inside dao");
          ResultSet rs=psmt.executeQuery();
          while(rs.next()){
               accid=rs.getLong(1);
               System.out.println("inside while");
          }
          if(s.getAccid()==accid){
              System.out.println("inside if");
              PreparedStatement psmt1=conn.prepareStatement("select * from deposit1_groupc_tja05 where Account_id =? and Transaction_Date between ? and ?");
              psmt1.setLong(1, accid);
              psmt1.setString(2, s.getDatefrom());
              psmt1.setString(3, s.getDateto());
              System.out.println(s.getDateto());
              ResultSet rs1=psmt1.executeQuery();
              while(rs1.next()){
                  System.out.println("inside inner while");
                   s1=new Statement(rs.getString(6),rs.getLong(7),rs.getLong(4),rs.getLong(3),rs.getString(5));
                   System.out.println(s1);
              }
          }
  
          return s1;
      }
  </code></pre>
  
  <p>But this query is not executing. Why?</p>