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;
}
}
最近下载更多
kingwjay LV2
5月21日
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日
最近浏览更多
cfdymtj LV2
12月9日
denliv_hui LV14
7月31日
kingwjay LV2
5月21日
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日

