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);
            }    
  • 相关阅读:
    mysql事务
    mysql查询操作教程
    mysql建表约束
    mysql数据库增删改查
    node服务器响应静态资源
    windows下golang版本的升级
    Linux开机错误
    redis命令
    nginx内置变量
    nginx日志
  • 原文地址:https://www.cnblogs.com/lichone2010/p/3175867.html
Copyright © 2011-2022 走看看