首页>代码>java jsp开发的电子商务系统代码下载>/java电子商务系统-毕业论文和项目/commerce/src/com/wgh/dao/MemberDaoImpl.java
package com.wgh.dao;

import commerce.member;
import com.wgh.DB.connDB;
import java.util.List;
import java.util.ArrayList;
import java.sql.ResultSet;
import java.sql.*;
import com.wgh.DB.chStr;

public class MemberDaoImpl
    implements MemberDao {
  private connDB conn = new connDB();
  //ִ�в������
  public int insert(member m) {
    chStr chStr = new chStr();
    int ret = -1;
    try {
      String sql = "Insert into tb_Member (UserName,TrueName,PassWord,City,address,postcode,CardNO,CardType,Tel,Email) values('" +
          chStr.chStr(m.getUsername()) + "','" + chStr.chStr(m.getTruename()) +
          "','" + chStr.chStr(m.getPwd()) +
          "','" + chStr.chStr(m.getCity()) + "','" + chStr.chStr(m.getAddress()) +
          "','" +
          chStr.chStr(m.getPostcode()) +
          "','" + chStr.chStr(m.getCardno()) + "','" +
          chStr.chStr(m.getCardtype()) + "','" + chStr.chStr(m.getTel()) +
          "','" + chStr.chStr(m.getEmail()) + "')";
      ret = conn.executeUpdate(sql);
    }
    catch (Exception e) {
      ret = 0;
    }
    conn.close();
    return ret;
  }

  //ִ���޸IJ���
  public int update(member m) {
    int ret = -1;
    chStr chStr = new chStr();
    try {
      String sql = "update tb_member set TrueName='" +
          chStr.chStr(m.getTruename()) +
          "',PassWord='" + chStr.chStr(m.getPwd()) + "',City='" +
          chStr.chStr(m.getCity()) + "',address='" + chStr.chStr(m.getAddress()) +
          "',postcode='" + chStr.chStr(m.getPostcode()) +
          "',CardNO='" + chStr.chStr(m.getCardno()) + "',CardType='" +
          chStr.chStr(m.getCardtype()) + "',Tel='" + chStr.chStr(m.getTel()) +
          "',Email='" + chStr.chStr(m.getEmail()) + "' where ID=" + m.getID();
      ret = conn.executeUpdate(sql);
    }
    catch (Exception e) {
      ret = 0;
    }
    conn.close();
    return ret;
  }

  //ִ��ɾ�����
  public int delete(member m) {
    String sql = "delect from tb_member where ID=" + m.getID();
    int ret = conn.executeUpdate(sql);
    conn.close();
    return 0;
  }

  //ִ�в�ѯ����
  public List select() {
    member form = null;
    List list = new ArrayList();
    String sql = "select * from tb_member";
    ResultSet rs = conn.executeQuery(sql);
    try {
      while (rs.next()) {
        form = new member();
        form.setID(Integer.valueOf(rs.getString(1)));

        list.add(form);
      }
    }
    catch (SQLException ex) {
    }
    conn.close();
    return list;
  }

  public member select1() {
    return null;
  }

}
最近下载更多
lawyer12321  LV1 3月21日
moyune1  LV2 2024年12月27日
84126415  LV2 2024年12月10日
yuanyuan927  LV1 2024年11月22日
微信网友_7222576034680832  LV2 2024年10月23日
colecole  LV3 2024年10月8日
hlFDGd  LV1 2024年6月11日
微信网友_7026079165190144  LV1 2024年6月6日
1234567tian  LV2 2024年6月1日
Qolmen  LV12 2024年5月11日
最近浏览更多
lawyer12321  LV1 3月21日
moyune1  LV2 2024年12月27日
ma406805131  LV19 2024年12月18日
WenMeng  LV9 2024年12月16日
565236523 2024年12月10日
暂无贡献等级
9632148963  LV1 2024年12月10日
84126415  LV2 2024年12月10日
yuanyuan927  LV1 2024年11月22日
dongandmin  LV8 2024年11月13日
3312djdad  LV2 2024年11月8日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友