日期:2014-05-17 浏览次数:20916 次
public TabCntvsOrder findObject(String ordernumber)
{
DbConnection dbcon = null;
Connection con=null;
PreparedStatement ps=null;
Statement st=null;
ResultSet rs=null;
ObjectClass oc= new ObjectClass();
try {
dbcon = new DbConnection();
con =dbcon.getCon();
st = con.createStatement();
String sql = "select * from TAB_CNTVSORDER where ORDERNUMBER='"+ordernumber+"'";
rs = st.executeQuery(sql);
while(rs.next()){
//将循环拿出的结果放入对象中去
oc.setId(rs.getInt(1));
}
} catch (Exception e) {
e.printStackTrace();
}
finally {
try {if (ps!=null) ps.close();}
catch (Exception e) {}
try {if (con!=null) con.close();}
catch (Exception e) {}
}
return tco;//返回你设值的对象
}