sql = "select * from attendance_test where att_check=''";
pstmt = con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
System.out.println("연결성공5");
if(rs.next()) {
System.out.println("연결성공6");
switch (i) {
case 0:
System.out.println("비어있는 값이군!?");
sql1 = "UPDATE attendance_test SET att_check='출석'";
break;
case 1:
System.out.println("비어있는 값이군!?");
sql1 = "UPDATE attendance_test SET att_check='지각'";
break;
case 2:
System.out.println("비어있는 값이군!?");
sql1 = "UPDATE attendance_test SET att_check='결석'";
break;
}
pstmt = con.prepareStatement(sql1);
return pstmt.executeUpdate();
}
return 0;
여기서 table이름은 attendance_test 이고, 테이블의 필드는 num, date, att_check로 구성 되어 있구요
att_check 필드의 초기값은 null로 설정 되어 있습니다. num과 date에는 값을 미리 설정했습니다.
그래서 att_check가 null인 것을 확인하고 update를 이용해서 값을 채워넣으려고 하는데요,, 자꾸 테이블 전체 null값에 값이 채워집니다. ㅠㅠ
아무래도 rs.next()때문인 것 같은데, 이것을 빼고 어떻게 작성하면 좋을지 모르겠어서 계속 헤매고 있습니다. ㅠㅠ
고수님들 도와주세요 ㅠㅜㅠㅜ
|