当我传递查询时,我遇到了错误。
Errorno is Nil
Error String Is Query Problem.....
java.sql.SQLException: Column Index out of range, 2 > 1.
这是我java
方法中的代码。
PreparedStatement pstm=con.prepareStatement("select period from stu_attendancemaster where classid=? and absentdt>=? and absentdt<=?");
pstm.setInt(1,classid);
pstm.setDate(2,fromdt);
pstm.setDate(3,todt);
System.out.println("qry for prd "+pstm.toString());
rs=pstm.executeQuery();
System.out.println("after qry for prd "+pstm.toString());
if(rs.next()) {
stame = new Stu_AttendanceMasterEntity(rs.getInt(1), rs.getDate(2), rs.getInt(3), rs.getString(4), rs.getInt(5), rs.getString(6), rs.getTimestamp(7), rs.getString(8), rs.getTimestamp(9),rs.getString(10),rs.getInt(11),rs.getString(12));
} else {
flag=false;
errorstring=FN + P1 +" Class Name: " + Dep_ClassMasterDB.getClassname(classid) +" From Date: " +DateUtility.displayDate(fromdt,0) +" To Date: " +DateUtility.displayDate(todt,0) +N + V +DNE;
}
} catch(Exception e) {
flag=false;
errorstring="Query Problem..... "+e;