The error in this statement is:
PreparedStatement pstm=con.prepareStatement("select period from stu_attendancemaster where classid=? and absentdt>=? and absentdt<=?");
you need to select all 12 fields in the selected query.
Example: (I assume that you have 12 fields in the stu_attendancemaster table). Do it:
PreparedStatement pstm=con.prepareStatement("select * from stu_attendancemaster where classid=? and absentdt>=? and absentdt<=?");
if not, you can change the query request as follows
select `colName1`, `colName2`, `colName3`, `colName4`, `colName5`, `colName6`, `colName7`, `colName8`, `colName9`, `colName10`, `colName11`, `colName12`, from stu_attendancemaster where classid=? and absentdt>=? and absentdt<=?
Note : colName* must be your actual column name in the table.
EDIT . If you only need the period from the query: just rs.getInt(1) and delete rs.getInt(2) to rs.getInt(12)
Rule of thumb : the number of columns in the select clause and ResultSet.getXXX() should be the same.
source share