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; } //执行修改操作 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; } }
最近下载更多
woshixiaomu LV2
1月9日
1234dwaz11123a LV1
2023年12月13日
hxh666 LV2
2023年12月11日
syhsyhzxhzxh LV3
2023年10月23日
寒江雪2017 LV9
2023年8月2日
laureline LV1
2023年6月21日
alone2 LV2
2023年5月30日
The way LV1
2023年5月30日
自知则知之1 LV2
2023年5月26日
www111111111 LV2
2023年5月22日
最近浏览更多
苏青梧
3月25日
暂无贡献等级
烟橙沐雨 LV1
3月21日
wjh007 LV4
3月15日
Liang朝伟 LV1
1月5日
woshixiaomu LV2
1月2日
asddwh LV12
2023年12月29日
iiiiiiixiiiiii LV1
2023年12月28日
pangzhihui LV11
2023年12月27日
小小白银110 LV1
2023年12月26日
hxy19991216 LV4
2023年12月23日