zoukankan      html  css  js  c++  java
  • 关系管理系统:CustomerDaoimpl中添加用户代码update()

    public void update(Customer c){
            Connection conn = null;
            PreparedStatement st = null;
            ResultSet rs = null;
            try{
                conn = JdbcUtils.getConnection();
                String sql = "update customer set name=?,gender=?,birthday=?,cellphone=?,email=?,preference=?,type=?,description=? where id=?";
                st = conn.prepareStatement(sql);
                st.setString(1, c.getName());
                st.setString(2, c.getGender());
                st.setDate(3, new java.sql.Date(c.getBirthday().getTime()));
                st.setString(4, c.getCellphone());
                st.setString(5, c.getEmail());
                st.setString(6, c.getPreference());
                st.setString(7, c.getType());
                st.setString(8, c.getDescription());
                st.setString(9, c.getId());
                
                st.executeUpdate();
            }catch (Exception e) {
                throw new DaoException(e);
            }finally{
                JdbcUtils.release(conn, st, rs);
            }    
  • 相关阅读:
    UDP
    ICMP协议、DNS、ARP协议、ping、DHCP协议
    OSI七层模型和TCP/IP四层模型
    STL六大组件
    迭代器
    哈希表
    react wangeditor使用
    URL切割
    ES6对象合并
    nginx 访问本机文件
  • 原文地址:https://www.cnblogs.com/lichone2010/p/3175867.html
Copyright © 2011-2022 走看看