码迷,mamicode.com
首页 > 其他好文 > 详细

两个查找的方法

时间:2014-08-28 07:25:49      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:os   io   ar   sp   on   new   ad   c   sql   

public faurerMember findequipmentFacturer(String equipmentFacturer) {

  String sql = "select * from equipmentFacturer where equipmentFacturer=?";

  ResultSet rs = execQuery(sql, new Object[] { equipmentFacturer });

  try {    

if (rs.next()) {    

 faurerMember fmb = new faurerMember();

    fmb.setEquipmentFacturer(rs.getString("equipmentFacturer"));   

  fmb.setEquipmentFacturerName(rs       .getString("equipmentFacturerName"));    

 fmb.setEquipmentFacturerAddress(rs       .getString("equipmentFacturerAddress"));   

  fmb.setEquipmentFacturerPostcode(rs       .getString("equipmentFacturerPostcode"));  

   fmb.setEquipmentFacturerPhone(rs       .getString("equipmentFacturerPhone"));   

  fmb.setEquipmentFacturerPerson(rs       .getString("equipmentFacturerPerson"));  

   fmb.setAgentName(rs.getString("agentName"));   

  fmb.setAgentAddress(rs.getString("agentAddress"));   

  fmb.setAgentPostcode(rs.getString("agentPostcode"));

    fmb.setAgentPhone(rs.getString("agentPhone"));

    fmb.setAgentPerson(rs.getString("agentPerson"));  

   fmb.setAfterServiceName(rs.getString("afterServiceName"));  

   fmb.setAfterServiceAddress(rs.getString("afterServiceAddress"));  

   fmb.setAfterServicePostcode(rs       .getString("afterServicePostcode"));    

 fmb.setAfterServicePhone(rs.getString("afterServicePhone"));     

fmb.setProduct(rs.getString("product"));   

  fmb.setRemark1(rs.getString("remark1"));    

 return fmb;  

  }  

 }

catch (SQLException e) {

   // TODO Auto-generated catch block    e.printStackTrace();   

}finally {   

 super.clossAll();

  }   return null;

 }

 public List<faurerMember> findequipmentFacturerName(String name) {   

String sql = "select * from equipmentFacturer where equipmentFacturerName like ?";  

 Object[] params = {"%"+name+"%"};  

 ResultSet rs = super.execQuery(sql, params);

  List<faurerMember> flist = new ArrayList<faurerMember>();  

 try {    while(rs.next()) {  

   faurerMember fmb = new faurerMember();   

  fmb.setEquipmentFacturer(rs.getString("equipmentFacturer"));    

 fmb.setEquipmentFacturerName(rs       .getString("equipmentFacturerName"));     

fmb.setEquipmentFacturerAddress(rs       .getString("equipmentFacturerAddress"));  

   fmb.setEquipmentFacturerPostcode(rs       .getString("equipmentFacturerPostcode"));

    fmb.setEquipmentFacturerPhone(rs       .getString("equipmentFacturerPhone"));  

   fmb.setEquipmentFacturerPerson(rs       .getString("equipmentFacturerPerson"));   

  fmb.setAgentName(rs.getString("agentName"));  

   fmb.setAgentAddress(rs.getString("agentAddress"));   

  fmb.setAgentPostcode(rs.getString("agentPostcode"));  

   fmb.setAgentPhone(rs.getString("agentPhone"));  

   fmb.setAgentPerson(rs.getString("agentPerson"));  

   fmb.setAfterServiceName(rs.getString("afterServiceName"));   

  fmb.setAfterServiceAddress(rs.getString("afterServiceAddress"));  

   fmb.setAfterServicePostcode(rs       .getString("afterServicePostcode"));   

  fmb.setAfterServicePhone(rs.getString("afterServicePhone"));

    fmb.setProduct(rs.getString("product"));  

   fmb.setRemark1(rs.getString("remark1"));  

   flist.add(fmb);   

 }   

} catch (SQLException e) {  

  // TODO Auto-generated catch block    e.printStackTrace();

  } finally {    super.clossAll();   

}   return flist;

 }

两个查找的方法

标签:os   io   ar   sp   on   new   ad   c   sql   

原文地址:http://www.cnblogs.com/junlin9393/p/3940726.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!