Ejemplo n.º 1
0
 public void updateIcon(String name, String address) {
   ConnDB db = new ConnDB();
   conn = db.createConn();
   try {
     String sql = "update tb_master set master_img=? where master_name=?";
     ps = conn.prepareStatement(sql);
     ps.setString(1, address);
     ps.setString(2, name);
     ps.executeUpdate();
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     close();
   }
 }
Ejemplo n.º 2
0
 public void updateInfo(String name, String pwd, String sex) {
   ConnDB db = new ConnDB();
   conn = db.createConn();
   try {
     String sql = "update tb_master set master_password=?,master_sex=? where master_name=?";
     ps = conn.prepareStatement(sql);
     ps.setString(1, pwd);
     ps.setString(2, sex);
     ps.setString(3, name);
     ps.executeUpdate();
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     close();
   }
 }
Ejemplo n.º 3
0
 public void addManager(String name, String pwd, String sex) {
   ConnDB db = new ConnDB();
   conn = db.createConn();
   try {
     String sql = "insert into tb_master(master_name,master_password,master_sex) values(?,?,?)";
     ps = conn.prepareStatement(sql);
     ps.setString(1, name);
     ps.setString(2, pwd);
     ps.setString(3, sex);
     ps.executeUpdate();
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     close();
   }
 }
Ejemplo n.º 4
0
 public String selectImg(String name) {
   ConnDB db = new ConnDB();
   conn = db.createConn();
   String img = "";
   try {
     String sql = "select master_img from tb_master where master_name=?";
     ps = conn.prepareStatement(sql);
     ps.setString(1, name);
     rs = ps.executeQuery();
     if (rs.next()) {
       img = rs.getString(1);
       if (img == null) {
         img = "defalut.jpg";
       }
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     close();
   }
   return img;
 }
Ejemplo n.º 5
0
 public boolean checkUser(String name, String pwd) {
   boolean flag = false;
   ConnDB db = new ConnDB();
   conn = db.createConn();
   try {
     String sql = "select top 1 master_password from tb_master where master_name=?";
     ps = conn.prepareStatement(sql);
     ps.setString(1, name);
     rs = ps.executeQuery();
     if (rs.next()) {
       String dbpwd = rs.getString(1);
       if (pwd.equals(dbpwd)) {
         flag = true;
       } else {
         flag = false;
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     close();
   }
   return flag;
 }
Ejemplo n.º 6
0
 public boolean isHaveUser(String name) {
   boolean flag = false;
   ConnDB db = new ConnDB();
   conn = db.createConn();
   try {
     String sql = "select COUNT(*) from tb_master where master_name=?";
     ps = conn.prepareStatement(sql);
     ps.setString(1, name);
     rs = ps.executeQuery();
     if (rs.next()) {
       int num = rs.getInt(1);
       if (num != 0) {
         flag = true;
       } else {
         flag = false;
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     close();
   }
   return flag;
 }