日期:2014-05-20 浏览次数:20881 次
public ArrayList FindClrNameId(String ClrNameId) throws Exception { // 输入卡号或姓名查询方法 ArrayList list = new ArrayList(); // 创建一个list集合 String sql = "select ISS_CSC,ISS_TYPE,ISS_CLR_ID,ISS_CLR_NAME,ISS_COMPANY,iss_idate,ISS_AVA_TO,ISS_OPR from GWP where iss_clr_name=? or iss_clr_id=? order by iss_clr_id"; this.pstmt = conn.prepareStatement(sql);// 创建操作集 this.pstmt.setString(1, ClrNameId);// 传入卡内号 this.pstmt.setString(2, ClrNameId); ResultSet rs = pstmt.executeQuery();// 创建结果集,并执行sql语句 System.out.println("语句:"+sql); while (rs.next()) { // 当结果集不为空 Gwp gwp = new Gwp(); gwp.setIss_csc(rs.getString(1)); gwp.setIss_type(rs.getString(2)); gwp.setIss_clr_id(rs.getString(3)); gwp.setIss_clr_name(rs.getString(4)); gwp.setIss_company(rs.getString(5)); gwp.setIss_idate(rs.getString(6)); gwp.setIss_ava_to(rs.getString(7)); gwp.setIss_opr(rs.getString(8)); list.add(gwp); // 把结果添加到list集合 } this.pstmt.close(); return list; // 返回list结果 }
public ArrayList FindClrNameId(String ClrNameId) throws Exception { // 输入卡号或姓名查询方法 ArrayList list = new ArrayList(); // 创建一个list集合 String sql = "select ISS_CSC,ISS_TYPE,ISS_CLR_ID,ISS_CLR_NAME,ISS_COMPANY,iss_idate,ISS_AVA_TO,ISS_OPR from GWP where iss_clr_name='"+ClrNameId+"' or iss_clr_id='"+ClrNameId+"' order by iss_clr_id"; this.pstmt = conn.prepareStatement(sql);// 创建操作集 //this.pstmt.setString(1, "'"+ClrNameId+"'");// 传入卡内号 ResultSet rs = pstmt.executeQuery();// 创建结果集,并执行sql语句 while (rs.next()) { // 当结果集不为空 Gwp gwp = new Gwp(); gwp.setIss_csc(rs.getString(1)); gwp.setIss_type(rs.getString(2)); gwp.setIss_clr_id(rs.getString(3)); gwp.setIss_clr_name(rs.getString(4)); gwp.setIss_company(rs.getString(5)); gwp.setIss_idate(rs.getString(6)); gwp.setIss_ava_to(rs.getString(7)); gwp.setIss_opr(rs.getString(8)); list.add(gwp); // 把结果添加到list集合 } this.pstmt.close(); return list; // 返回list结果 }