日期:2014-05-20 浏览次数:21280 次
public void getlist() throws UnsupportedEncodingException {
Connection con = Connect.getCon();
ResultSet rs = null;
Statement stm = null;
members.clear();
String ctymsql="";
try {
con.setAutoCommit(false);
stm = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
int rows = sh.getRows();
System.out.println(rows);
String email="";
for (int i = 1; i < rows; i++) {
sql.getsql(i);
email=sh.getCell(sql.getCytmembermap().get("EMAIL"), i).getContents();
ctymsql = sql.getCtymsql();
ctyhList.add(sql.getCtyhsql());
//ctymList.add(sql.getCtymsql());
ctysList.add(sql.getCtyssql());
//System.out.println(m6699sql);
stm.executeUpdate(ctymsql, Statement.RETURN_GENERATED_KEYS);
//System.out.println("-------------");
int autoIncKeyFromFunc = -1;
rs = stm.executeQuery("select member_autoinc.currval as cur from dual");
if (rs.next()) {
autoIncKeyFromFunc = rs.getInt("cur");
members.add(autoIncKeyFromFunc);
if(!email.equals("")){
//插入数据表member_email
stm.execute("insert into tbl_member_email(MEMBER_ID,EMAIL,FLAG) value("+autoIncKeyFromFunc+",'"+email+"',0)");
}
} else {
// throw an exception from here
}
rs.close();
rs = null;
}
con.commit();