2024.5.8

 public static int search_line(String station){
      int line =1;
        try {
            Connection conn = util.getConnection();
            Statement state = null;
            String sql="select * from buke where station=?";
            PreparedStatement  pstmt = conn.prepareStatement(sql);
            pstmt.setString(1,station);
            ResultSet rs = pstmt.executeQuery();
            while(rs.next()){

                line= Integer.parseInt((rs.getString("line")));

            }
            rs.close();
            pstmt.close();
            conn.close();
        }
        catch(SQLException e) {

            e.printStackTrace();
        }
        return line;

    }
posted @ 2024-05-08 23:32  Verneyyx  阅读(12)  评论(0)    收藏  举报