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;
}
浙公网安备 33010602011771号