Page 111 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 111
902.
903. }catch(Exception e){
904. e.printStackTrace();
905. }
906.
907. return(result);
908.
909. }
910.
911. /**
912. * @메소드명 : idCount
913. * @반환값 : result
914. * @설명 : passenger의 총 승객의 값을 정수로 출력하여 다음 번
호가 무엇인지 알아내어 출력하는 메소드
915. */
916. private int idCount(){
917. PreparedStatement A;
918. ResultSet rs;
919. int i = 0;
920.
921. try{
922.
923. //PreparedStatement 생성-> conn은 preDbTreatment() 메소드를 통해
//생성되어 있음
924. A = conn.prepareStatement("SELECT * FROM
passenger");
925.
926. rs = A.executeQuery(); //실행
927.
928.
929. // 총 몇 명의 승객이 있는 지 확인
930. while(rs.next()){
931. i++;
932. }
933.
934.
935.
936. }catch(Exception e){
937. e.printStackTrace();
938. }
939.
- 104 -