Here is the sample method is given which is retuning the database values with the arraylist.
public ArrayList
            ArrayList
            MYSQLConnect connect=new MYSQLConnect();
            Connection conn = connect.connection;
            Statement smt = conn.createStatement();
            ResultSet rs;
            //int no=0;
            //String[]str=new String[20];
            //write select query for checking password 
    String query="select DISTINCT `date` from attendance where (Date between 
                  '"+datefrom+"' and '"+dateto+"')";      
    rs=smt.executeQuery(query);
            while(rs.next()== true){
                  StudentDetailsForm form =new StudentDetailsForm();
                  form.setDateFrom(rs.getString("date"));
                  list1.add(form);
                  
      }
            smt.close();
            rs.close();
            conn.close();
            return list1;
      }
No comments:
Post a Comment