Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String soMui(String tenBenh) {
- // String ketQua = "";
- // try {
- // Class.forName("com.mysql.jdbc.Driver").newInstance();
- // Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/baitap?"
- // + "user=root&password=123456");
- //
- // String sql = "select MaBenh from benh where TenBenh = '" + tenBenh + "'";
- // PreparedStatement ps = conn.prepareStatement(sql);
- //
- // ResultSet rs = ps.executeQuery();
- // String MaBenh = "";
- // while (rs.next()) {
- // MaBenh = rs.getString("MaBenh");
- // }
- //
- // if (!"".equals(MaBenh)) {
- // sql = "select TenVacxin, SoMui from (vacxin, phongbenh) where vacxin.MaVacxin = phongbenh.MaVacxin and phongbenh.MaBenh = '" + MaBenh + "'";
- // ps = conn.prepareStatement(sql);
- // rs = ps.executeQuery();
- //
- // while (rs.next()) {
- // ketQua += rs.getString("TenVacxin") + ": " + rs.getInt("SoMui") +"\n";
- // }
- // } else {
- // ketQua = "Khong tim thay";
- // }
- //
- // } catch (ClassNotFoundException ex) {
- // Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
- // } catch (SQLException ex) {
- // Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
- // } catch (InstantiationException ex) {
- // Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
- // } catch (IllegalAccessException ex) {
- // Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
- // }
- // return ketQua;
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement